mirror of
https://github.com/fosrl/pangolin.git
synced 2025-08-22 10:19:04 +02:00
show account already exists if email not verified
This commit is contained in:
parent
d194e230de
commit
7bf9cccbf6
1 changed files with 15 additions and 9 deletions
|
@ -143,15 +143,21 @@ export async function signup(
|
||||||
|
|
||||||
if (diff < 2) {
|
if (diff < 2) {
|
||||||
// If the user was created less than 2 hours ago, we don't want to create a new user
|
// If the user was created less than 2 hours ago, we don't want to create a new user
|
||||||
return response<SignUpResponse>(res, {
|
return next(
|
||||||
data: {
|
createHttpError(
|
||||||
emailVerificationRequired: true
|
HttpCode.BAD_REQUEST,
|
||||||
},
|
"A user with that email address already exists"
|
||||||
success: true,
|
)
|
||||||
error: false,
|
);
|
||||||
message: `A user with that email address already exists. We sent an email to ${email} with a verification code.`,
|
// return response<SignUpResponse>(res, {
|
||||||
status: HttpCode.OK
|
// data: {
|
||||||
});
|
// emailVerificationRequired: true
|
||||||
|
// },
|
||||||
|
// success: true,
|
||||||
|
// error: false,
|
||||||
|
// message: `A user with that email address already exists. We sent an email to ${email} with a verification code.`,
|
||||||
|
// status: HttpCode.OK
|
||||||
|
// });
|
||||||
} else {
|
} else {
|
||||||
// If the user was created more than 2 hours ago, we want to delete the old user and create a new one
|
// If the user was created more than 2 hours ago, we want to delete the old user and create a new one
|
||||||
await db.delete(users).where(eq(users.userId, user.userId));
|
await db.delete(users).where(eq(users.userId, user.userId));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue