mirror of
https://github.com/C4illin/ConvertX.git
synced 2025-10-24 16:43:52 +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 = [];
|
const values = [];
|
||||||
|
|
||||||
if (body.email) {
|
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");
|
fields.push("email");
|
||||||
values.push(body.email);
|
values.push(body.email);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user