Merged in bug-fixing-8-sep-24_2 (pull request #100)

Bug fixing 8 sep 24 2

Approved-by: Tiago Ribeiro
This commit is contained in:
João Ramos
2024-09-08 09:22:05 +00:00
committed by Tiago Ribeiro
2 changed files with 9 additions and 2 deletions

View File

@@ -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 = {

View File

@@ -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<User>({ 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<User>({ 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 }
);