mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 15:20:34 +00:00
fix: reset password bug.
This commit is contained in:
@@ -226,6 +226,7 @@ export default class AuthenticationController extends BaseController{
|
|||||||
|
|
||||||
return res.status(200).send({
|
return res.status(200).send({
|
||||||
code: 'SEND_RESET_PASSWORD_SUCCESS',
|
code: 'SEND_RESET_PASSWORD_SUCCESS',
|
||||||
|
message: 'The reset password message has been sent successfully.'
|
||||||
});
|
});
|
||||||
} catch(error) {
|
} catch(error) {
|
||||||
if (error instanceof ServiceError) {
|
if (error instanceof ServiceError) {
|
||||||
@@ -249,6 +250,7 @@ export default class AuthenticationController extends BaseController{
|
|||||||
|
|
||||||
return res.status(200).send({
|
return res.status(200).send({
|
||||||
type: 'RESET_PASSWORD_SUCCESS',
|
type: 'RESET_PASSWORD_SUCCESS',
|
||||||
|
message: 'The password has been reset successfully.'
|
||||||
})
|
})
|
||||||
} catch(error) {
|
} catch(error) {
|
||||||
next(error);
|
next(error);
|
||||||
@@ -299,5 +301,6 @@ export default class AuthenticationController extends BaseController{
|
|||||||
return res.boom.badRequest(null, { errors: errorReasons });
|
return res.boom.badRequest(null, { errors: errorReasons });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
next(error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -279,7 +279,7 @@ export default class AuthenticationService implements IAuthenticationService {
|
|||||||
const hashedPassword = await hashPassword(password);
|
const hashedPassword = await hashPassword(password);
|
||||||
|
|
||||||
this.logger.info('[reset_password] saving a new hashed 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.
|
// Deletes the used token.
|
||||||
await this.deletePasswordResetToken(tokenModel.email);
|
await this.deletePasswordResetToken(tokenModel.email);
|
||||||
|
|||||||
Reference in New Issue
Block a user