Magic-link sign in UI and APIs
This commit is contained in:
@@ -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,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"
|
||||
|
||||
@@ -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])
|
||||
|
||||
Reference in New Issue
Block a user