mirror of
https://github.com/C4illin/ConvertX.git
synced 2025-10-23 04:52:18 +00:00
Update src/index.tsx
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
This commit is contained in:
@@ -599,6 +599,14 @@ const app = new Elysia({
|
||||
const values = [];
|
||||
|
||||
if (body.email) {
|
||||
// Enforce unique email constraint
|
||||
const existingUser = await db.query(
|
||||
"SELECT id FROM users WHERE email = ?",
|
||||
).get(body.email);
|
||||
if (existingUser && existingUser.id !== user.id) {
|
||||
set.status = 409;
|
||||
return { message: "Email already in use." };
|
||||
}
|
||||
fields.push("email");
|
||||
values.push(body.email);
|
||||
}
|
||||
|
Reference in New Issue
Block a user