From 82c2b6b0f398425743241ff6c377bff12de2990d Mon Sep 17 00:00:00 2001 From: "a.bouhuolia" Date: Thu, 17 Dec 2020 18:58:21 +0200 Subject: [PATCH] fix: reset password bug. --- server/src/api/controllers/Authentication.ts | 3 +++ server/src/services/Authentication/index.ts | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/server/src/api/controllers/Authentication.ts b/server/src/api/controllers/Authentication.ts index 4c4978375..9e8d77824 100644 --- a/server/src/api/controllers/Authentication.ts +++ b/server/src/api/controllers/Authentication.ts @@ -226,6 +226,7 @@ export default class AuthenticationController extends BaseController{ return res.status(200).send({ code: 'SEND_RESET_PASSWORD_SUCCESS', + message: 'The reset password message has been sent successfully.' }); } catch(error) { if (error instanceof ServiceError) { @@ -249,6 +250,7 @@ export default class AuthenticationController extends BaseController{ return res.status(200).send({ type: 'RESET_PASSWORD_SUCCESS', + message: 'The password has been reset successfully.' }) } catch(error) { next(error); @@ -299,5 +301,6 @@ export default class AuthenticationController extends BaseController{ return res.boom.badRequest(null, { errors: errorReasons }); } } + next(error); } }; diff --git a/server/src/services/Authentication/index.ts b/server/src/services/Authentication/index.ts index 678fce08f..18e3564ed 100644 --- a/server/src/services/Authentication/index.ts +++ b/server/src/services/Authentication/index.ts @@ -279,7 +279,7 @@ export default class AuthenticationService implements IAuthenticationService { const hashedPassword = await hashPassword(password); this.logger.info('[reset_password] saving a new hashed password.'); - await systemUserRepository.edit(user.id, { password: hashedPassword }); + await systemUserRepository.update({ password: hashedPassword }, { id: user.id }); // Deletes the used token. await this.deletePasswordResetToken(tokenModel.email);