This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<task_description> | |
The user of a code editor wants to make a change to their codebase. | |
You must describe the change using the following XML structure: | |
- <patch> - A group of related code changes. | |
Child tags: | |
- <title> (required) - A high-level description of the changes. This should be as short | |
as possible, possibly using common abbreviations. | |
- <edit> (1 or more) - An edit to make at a particular range within a file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useUser } from "@clerk/nextjs"; | |
import { type NextPage } from "next"; | |
import { useState } from "react"; | |
import QRCode from "react-qr-code"; | |
const MFACreator: NextPage = () => { | |
const [qrUri, setQRURI] = useState(""); | |
const [readyToVerify, setReadyToVerify] = useState(false); | |
const [verified, setVerified] = useState(false); | |
const [code, setCode] = useState(""); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState } from "react"; | |
import { useSignIn } from "@clerk/nextjs"; | |
import { useRouter } from "next/router"; | |
export default function SignInForm() { | |
const { isLoaded, signIn, setActive } = useSignIn(); | |
const [emailAddress, setEmailAddress] = useState(""); | |
const [password, setPassword] = useState(""); | |
const [totp, setTotp] = useState(""); | |
const [needsVerify, setNeedsVerify] = useState(false); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import '../styles/globals.css' | |
import { ClerkProvider, SignInButton, SignedIn, SignedOut, SignOutButton } from '@clerk/nextjs' | |
import { Inter } from 'next/font/google' | |
import Image from 'next/image' | |
import Script from 'next/script' | |
import styles from '../styles/Header.module.css' | |
import Link from 'next/link' | |
const inter = Inter({ subsets: ['latin'] }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { getAuth, withClerkMiddleware } from "@clerk/nextjs/server"; | |
import { NextResponse, NextFetchEvent } from "next/server"; | |
import type { NextRequest } from "next/server"; | |
import { Ratelimit } from "@upstash/ratelimit"; | |
import { Redis } from "@upstash/redis"; | |
// Add public paths for Clerk to handle. | |
const publicPaths = ["/", "/sign-in*", "/sign-up*", "/api/blocked"]; | |
// set your rate limit. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
await signUp | |
.create({ | |
phoneNumber, | |
}) | |
.catch((err) => { | |
if (err.errors[0].code === "form_identifier_exists") { | |
//handle it now. | |
console.log("gracefully handle this error and switch them to sign in") | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import type { IncomingHttpHeaders } from "http"; | |
import type { NextApiRequest, NextApiResponse } from "next"; | |
import type { WebhookRequiredHeaders } from "svix"; | |
import type { User } from "@clerk/nextjs/dist/api"; | |
import { Webhook } from "svix"; | |
import { prisma } from "../../server/db"; | |
type UnwantedKeys = "emailAddresses" | "firstName" | "lastName" | "primaryEmailAddressId" | "primaryPhoneNumberId" | "phoneNumbers"; | |
interface UserInterface extends Omit<User , UnwantedKeys>{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html, | |
body { | |
padding: 0; | |
margin: 0; | |
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, | |
Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; | |
} | |
a { | |
color: inherit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const functions = require("firebase-functions"); | |
exports.getToken = | |
functions.https.onRequest((req, res) => { | |
res.set("Access-Control-Allow-Origin", "SET ORIGIN"); | |
if (req.method === "OPTIONS") { | |
// Send response to OPTIONS requests | |
res.set("Access-Control-Allow-Methods", "GET"); | |
res.set("Access-Control-Allow-Headers", "Content-Type"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm install @11ty/eleventy @11ty/eleventy-plugin-syntaxhighlight @tailwindcss/typography autoprefixer cross-env css-loader mini-css-extract-plugin npm-run-all postcss postcss-import postcss-loader tailwindcss webpack webpack-cli |
NewerOlder