mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 16:38:19 +01:00
fix(api): 🐛 Error out on registration when email is already taken
This commit is contained in:
parent
065b37f091
commit
2ea5612759
|
|
@ -166,6 +166,13 @@ export default apiRoute<typeof meta, typeof schema>(
|
||||||
description: "is from a blocked email provider",
|
description: "is from a blocked email provider",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Check if email is taken
|
||||||
|
if (await User.fromSql(eq(Users.email, body.email)))
|
||||||
|
errors.details.email.push({
|
||||||
|
error: "ERR_TAKEN",
|
||||||
|
description: "is already taken",
|
||||||
|
});
|
||||||
|
|
||||||
// Check if agreement is accepted
|
// Check if agreement is accepted
|
||||||
if (!body.agreement)
|
if (!body.agreement)
|
||||||
errors.details.agreement.push({
|
errors.details.agreement.push({
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue