mirror of
https://github.com/R0m1k3/Regisflow.git
synced 2026-10-11 17:29:48 +02:00
Prevent users from creating accounts with a blank email address
Handle empty email strings by setting them to null to avoid database constraint errors in `server/storage.ts`. Replit-Commit-Author: Agent Replit-Commit-Session-Id: dec54137-d5a2-4406-8ad4-5f2f9fb110bf Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/0715008c-7244-40f4-befc-26c014852236/56f97713-69fd-41d1-b933-ff4440458da0.jpg
This commit is contained in:
1 parent
db18a68ae6
commit
0db1bffa94
1 file changed
+10
@@ -60,6 +60,11 @@ export class DatabaseStorage implements IStorage {
|
||||
userData.password = await this.hashPassword(userData.password);
|
||||
}
|
||||
|
||||
// Convert empty email to null to avoid unique constraint issues
|
||||
if (userData.email === "") {
|
||||
userData.email = null;
|
||||
}
|
||||
|
||||
const [user] = await db
|
||||
.insert(users)
|
||||
.values(userData)
|
||||
@@ -73,6 +78,11 @@ export class DatabaseStorage implements IStorage {
|
||||
userData.password = await this.hashPassword(userData.password);
|
||||
}
|
||||
|
||||
// Convert empty email to null to avoid unique constraint issues
|
||||
if (userData.email === "") {
|
||||
userData.email = null;
|
||||
}
|
||||
|
||||
const [user] = await db
|
||||
.update(users)
|
||||
.set(userData)
|
||||
|
||||
Reference in new issue
Block a user