diff --git a/server/src/modules/auth/oauth/service.ts b/server/src/modules/auth/oauth/service.ts index 8c05d07a35..b289f64628 100644 --- a/server/src/modules/auth/oauth/service.ts +++ b/server/src/modules/auth/oauth/service.ts @@ -320,6 +320,11 @@ export class OauthService implements IOAuthService { organizationDetails = await this.organizationRepository.fetchOrganization(userDetails.defaultOrganizationId); } + // Clear forgot password token + if (userDetails.forgotPasswordToken) { + await this.userRepository.updateOne(userDetails.id, { forgotPasswordToken: null }, manager); + } + return await this.sessionUtilService.generateLoginResultPayload( response, userDetails, diff --git a/server/src/modules/auth/service.ts b/server/src/modules/auth/service.ts index 7470d6f39d..5175197ceb 100644 --- a/server/src/modules/auth/service.ts +++ b/server/src/modules/auth/service.ts @@ -109,6 +109,7 @@ export class AuthService implements IAuthService { const updateData = { ...(shouldUpdateDefaultOrgId && { defaultOrganizationId: organization?.id }), passwordRetryCount: 0, + forgotPasswordToken: null, }; await this.userRepository.updateOne(user.id, updateData, manager);