feat(auth): add password reset flow with OTP

- Add password-reset Prisma schema for OTP tracking
- Add API contract schemas (start, verify, resend)
- Add password-reset service with OTP validation and email sending
- Add frontend reset-password page with 2-step flow
- Add InputOTP component usage for OTP input
- Add link to reset-password in login page
- Remove link to About in login
- Center and resize login/reset password forms
This commit is contained in:
Jose Selesan
2026-04-13 09:10:06 -03:00
parent 566291fb43
commit 70273f6760
13 changed files with 906 additions and 7 deletions

View File

@@ -0,0 +1,21 @@
-- CreateTable
CREATE TABLE "password_reset_requests" (
"id" UUID NOT NULL,
"email" TEXT NOT NULL,
"otp_hash" TEXT NOT NULL,
"otp_expires_at" TIMESTAMP(3) NOT NULL,
"otp_attempts" INTEGER NOT NULL DEFAULT 0,
"otp_last_sent_at" TIMESTAMP(3) NOT NULL,
"otp_resend_count" INTEGER NOT NULL DEFAULT 0,
"used_at" TIMESTAMP(3),
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updated_at" TIMESTAMP(3) NOT NULL,
CONSTRAINT "password_reset_requests_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE INDEX "password_reset_requests_email_idx" ON "password_reset_requests"("email");
-- CreateIndex
CREATE INDEX "password_reset_requests_otp_expires_at_idx" ON "password_reset_requests"("otp_expires_at");

View File

@@ -0,0 +1,16 @@
model PasswordResetRequest {
id String @id @db.Uuid
email String
otpHash String @map("otp_hash")
otpExpiresAt DateTime @map("otp_expires_at")
otpAttempts Int @default(0) @map("otp_attempts")
otpLastSentAt DateTime @map("otp_last_sent_at")
otpResendCount Int @default(0) @map("otp_resend_count")
usedAt DateTime? @map("used_at")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
@@index([email])
@@index([otpExpiresAt])
@@map("password_reset_requests")
}