Improve user registration and access control for different account types

Adds admin user creation, role-based access, password confirmation, and professional profile fields to the user schema.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 556aa286-edd2-4cea-8583-f4fc3cfd119b
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/81470e0d-8ae8-4335-9301-cd9a69e670fa/8e77b04a-d19f-45af-9f57-84d64672fc92.jpg
This commit is contained in:
ghaddaditw
2025-05-30 17:22:52 +00:00
parent 41678c90bf
commit 1f6e5f5374
3 changed files with 2934 additions and 1 deletions
+9 -1
View File
@@ -24,12 +24,20 @@ export const authController = {
const saltRounds = 12;
const hashedPassword = await bcrypt.hash(validatedData.password, saltRounds);
// Determine role - special handling for admin user
let userRole = "standard";
if (validatedData.email === "dev@adminlocal.com") {
userRole = "admin";
} else if (validatedData.role === "pro") {
userRole = "pro";
}
// Create user
const user = await storage.createUser({
username: validatedData.username,
email: validatedData.email,
password: hashedPassword,
role: validatedData.role || 'standard',
role: userRole,
firstName: validatedData.firstName,
lastName: validatedData.lastName,
onboardingComplete: false,