From 4e91b2f1fb5258f87b3a89bed6a3cc5c583e02a4 Mon Sep 17 00:00:00 2001 From: Joao Ramos Date: Sun, 8 Sep 2024 10:08:24 +0100 Subject: [PATCH 1/2] ENCOA-202: Fixed issue updating user --- src/pages/api/users/update.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pages/api/users/update.ts b/src/pages/api/users/update.ts index 4f7ba431..121a01b3 100644 --- a/src/pages/api/users/update.ts +++ b/src/pages/api/users/update.ts @@ -77,7 +77,8 @@ async function handler(req: NextApiRequest, res: NextApiResponse) { const queryId = req.query.id as string; - let user = await db.collection("users").findOne({ id: queryId ? (queryId as string) : req.session.user.id }); + const userId = queryId ? (queryId as string) : req.session.user.id + let user = await db.collection("users").findOne({ id: userId }); const updatedUser = req.body as User & { password?: string; newPassword?: string }; if (!!queryId) { @@ -160,7 +161,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) { delete updatedUser.newPassword; await db.collection("users").updateOne( - { id: queryId }, + { id: userId }, { $set: updatedUser } ); From 2e065eddcb9a0d7a20571bb5db72ba0ee3e2bd8e Mon Sep 17 00:00:00 2001 From: Joao Ramos Date: Sun, 8 Sep 2024 10:19:49 +0100 Subject: [PATCH 2/2] Added an workaround for the broken email system --- src/pages/api/register.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/pages/api/register.ts b/src/pages/api/register.ts index 32636243..e0f0b591 100644 --- a/src/pages/api/register.ts +++ b/src/pages/api/register.ts @@ -72,6 +72,9 @@ async function registerIndividual(req: NextApiRequest, res: NextApiResponse) { ...(passport_id ? {demographicInformation: {passport_id}} : {}), registrationDate: new Date().toISOString(), status: code ? "active" : "paymentDue", + // apparently there's an issue with the verification email system + // therefore we will skip this requirement for now + isVerified: true, }; await db.collection("users").insertOne(user); @@ -117,6 +120,9 @@ async function registerCorporate(req: NextApiRequest, res: NextApiResponse) { subscriptionExpirationDate: req.body.subscriptionExpirationDate || null, status: "paymentDue", registrationDate: new Date().toISOString(), + // apparently there's an issue with the verification email system + // therefore we will skip this requirement for now + isVerified: true, }; const defaultTeachersGroup: Group = {