Magic-link sign in UI and APIs

This commit is contained in:
adilallo
2026-04-06 16:37:15 -06:00
parent 331ed40234
commit 7218947df3
74 changed files with 1582 additions and 363 deletions
@@ -0,0 +1,2 @@
-- Drop legacy email OTP table (product uses magic link only).
DROP TABLE IF EXISTS "OtpChallenge";
@@ -0,0 +1,17 @@
-- CreateTable
CREATE TABLE "MagicLinkToken" (
"id" TEXT NOT NULL,
"email" TEXT NOT NULL,
"tokenHash" TEXT NOT NULL,
"expiresAt" TIMESTAMP(3) NOT NULL,
"nextPath" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "MagicLinkToken_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "MagicLinkToken_tokenHash_key" ON "MagicLinkToken"("tokenHash");
-- CreateIndex
CREATE INDEX "MagicLinkToken_email_idx" ON "MagicLinkToken"("email");
+1 -1
View File
@@ -1,3 +1,3 @@
# Please do not edit this file manually
# It should be added in your version-control system (i.e. Git)
# It should be added in your version-control system (e.g., Git)
provider = "postgresql"
+3 -3
View File
@@ -29,12 +29,12 @@ model Session {
@@index([userId])
}
model OtpChallenge {
model MagicLinkToken {
id String @id @default(cuid())
email String
codeHash String
tokenHash String @unique
expiresAt DateTime
attempts Int @default(0)
nextPath String?
createdAt DateTime @default(now())
@@index([email])