From 51e22a4611dab8edcd7295e4208233e21a49f8ca Mon Sep 17 00:00:00 2001 From: adueck Date: Sun, 17 Dec 2023 11:19:05 +0400 Subject: [PATCH] error in sending back messages on e-mail signup --- account/src/lib/user-utils.ts | 2 -- account/src/routers/auth-router.ts | 6 +++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/account/src/lib/user-utils.ts b/account/src/lib/user-utils.ts index 2421437..6ef9dd7 100644 --- a/account/src/lib/user-utils.ts +++ b/account/src/lib/user-utils.ts @@ -157,14 +157,12 @@ export async function createNewUser( lastLogin: now, lastActive: now, }; - console.log("SENDING VERIFICATION EMAIL FROM SIGNUP"); await sendVerificationEmail({ name: input.name, uid: userId, email: input.email || "", token: email.token, }); - console.log("GOT THROUGH AFTER VERIFICATION"); const user = await insertLingdocsUser(newUser); return user; } diff --git a/account/src/routers/auth-router.ts b/account/src/routers/auth-router.ts index 086fc32..c04820c 100644 --- a/account/src/routers/auth-router.ts +++ b/account/src/routers/auth-router.ts @@ -176,7 +176,8 @@ const authRouter = (passport: PassportStatic) => { try { const { email, password, name } = req.body; const existingUser = await getLingdocsUser("email", email); - if (existingUser) return res.send("User Already Exists"); + if (existingUser) + return res.send({ ok: false, message: "User Already Exists" }); try { const user = await createNewUser({ strategy: "local", @@ -190,8 +191,7 @@ const authRouter = (passport: PassportStatic) => { }); } catch (e) { console.error(e); - console.error("EMAIL DIDN'T WORK 2"); - return res.send("Invalid E-mail"); + return res.send({ ok: false, message: "Invalid E-mail" }); } } catch (e) { next(e);