show account already exists if email not verified

This commit is contained in:
miloschwartz 2025-06-25 16:51:49 -04:00
parent d194e230de
commit 7bf9cccbf6
No known key found for this signature in database

View file

@ -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));