From 369958ff81de9ec94b1353d8a60dcbf28aec46b0 Mon Sep 17 00:00:00 2001 From: Konstantinos Kopanidis Date: Mon, 20 May 2024 19:03:17 +0300 Subject: [PATCH] feat(authentication): remove verification requirement for forgot password feat(authentication): change previous default team status when assigning a new one --- modules/authentication/src/admin/team.ts | 3 +++ modules/authentication/src/handlers/local.ts | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/authentication/src/admin/team.ts b/modules/authentication/src/admin/team.ts index a8bc68814..e2d3cca50 100644 --- a/modules/authentication/src/admin/team.ts +++ b/modules/authentication/src/admin/team.ts @@ -303,6 +303,9 @@ export class TeamsAdmin { throw new GrpcError(status.ALREADY_EXISTS, 'Team with that name already exists'); } } + if (!found.isDefault && isDefault) { + await Team.getInstance().updateOne({ isDefault: true }, { isDefault: false }); + } const updatedTeam = await Team.getInstance().findByIdAndUpdate(teamId, { name, diff --git a/modules/authentication/src/handlers/local.ts b/modules/authentication/src/handlers/local.ts index 82ee1692e..0c7976335 100644 --- a/modules/authentication/src/handlers/local.ts +++ b/modules/authentication/src/handlers/local.ts @@ -348,7 +348,7 @@ export class LocalHandlers implements IAuthenticationStrategy { }); const link = `${redirectUri}?reset_token=${passwordResetTokenDoc.token}`; - if (config.local.verification.send_email && this.grpcSdk.isAvailable('email')) { + if (this.grpcSdk.isAvailable('email')) { await this.emailModule .sendEmail('ForgotPassword', { email: user.email,