feat: implement user registration functionality

- Created registerUser server action with email/password validation
- Implemented password hashing with bcrypt (10 rounds)
- Added email uniqueness check to prevent duplicate registrations
- Created session after successful registration using NextAuth
- Added comprehensive validation for email format and password length (min 8 chars)
- Added email and password validation utilities to lib/validation.ts
- Removed PrismaAdapter from auth.ts (using JWT sessions only)
- Added vitest testing framework and configuration
- Created comprehensive unit tests for registration functionality
- All tests passing (6/6)

Requirements covered: 1.1, 1.2, 1.3, 1.4, 1.5
This commit is contained in:
2025-12-02 00:03:23 +00:00
parent 174a6601b2
commit 70121982a0
8 changed files with 1661 additions and 6 deletions

View File

@@ -7,6 +7,8 @@
"build": "next build",
"start": "next start",
"lint": "next lint",
"test": "vitest --run",
"test:watch": "vitest",
"db:push": "prisma db push",
"db:studio": "prisma studio",
"icons:generate": "node scripts/generate-icons.js",
@@ -29,12 +31,14 @@
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"@vitest/ui": "^4.0.14",
"autoprefixer": "^10.0.1",
"eslint": "^8",
"eslint-config-next": "14.0.4",
"postcss": "^8",
"prisma": "^5.7.1",
"tailwindcss": "^3.3.0",
"typescript": "^5"
"typescript": "^5",
"vitest": "^4.0.14"
}
}