pallies
Version:
Robust user management for Hapi
22 lines (17 loc) • 572 B
JavaScript
;
module.exports = {
method: 'POST',
path: '/reset-password',
options: {
auth: {
strategy: 'jwt',
mode: 'optional'
},
handler: async (request, h) => {
const AuthService = h.services().authService;
const { oldPassword, userHash, forgotPasswordToken, newPassword } = request.payload;
await AuthService.resetPassword(request.auth.credentials, oldPassword, userHash, forgotPasswordToken, newPassword);
return h.response().code(204);
}
}
};