forgot password in login page and account info implemented, sms.ir service works fine with sandbox key.

This commit is contained in:
2026-07-04 00:01:58 +03:30
parent 2f95559087
commit 3f7364dbf0
26 changed files with 1000 additions and 38 deletions

View File

@@ -0,0 +1,25 @@
-- AlterTable
ALTER TABLE "users" ADD COLUMN "mobile" TEXT;
-- CreateIndex
CREATE UNIQUE INDEX "users_mobile_key" ON "users"("mobile");
-- CreateTable
CREATE TABLE "phone_verification_codes" (
"id" TEXT NOT NULL,
"userId" TEXT,
"mobile" TEXT NOT NULL,
"codeHash" TEXT NOT NULL,
"purpose" TEXT NOT NULL,
"expiresAt" TIMESTAMP(3) NOT NULL,
"verifiedAt" TIMESTAMP(3),
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "phone_verification_codes_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE INDEX "phone_verification_codes_mobile_purpose_createdAt_idx" ON "phone_verification_codes"("mobile", "purpose", "createdAt");
-- AddForeignKey
ALTER TABLE "phone_verification_codes" ADD CONSTRAINT "phone_verification_codes_userId_fkey" FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;

View File

@@ -11,6 +11,7 @@ datasource db {
model User {
id String @id @default(uuid())
email String @unique
mobile String? @unique
passwordHash String?
googleId String? @unique
facebookId String? @unique
@@ -23,6 +24,7 @@ model User {
sessions Session[] // 👈 ADD THIS - opposite relation for Session
sentStaffInvites StaffInvitation[]
sentOrganizationInvitations OrganizationInvitation[]
phoneVerificationCodes PhoneVerificationCode[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@ -30,6 +32,22 @@ model User {
@@map("users")
}
model PhoneVerificationCode {
id String @id @default(uuid())
userId String?
mobile String
codeHash String
purpose String
expiresAt DateTime
verifiedAt DateTime?
createdAt DateTime @default(now())
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
@@index([mobile, purpose, createdAt])
@@map("phone_verification_codes")
}
model OrganizationType {
id String @id @default(uuid())
name String @unique // "CLINIC" or "LAB"