diff --git a/backend/apis/nodejs/src/models/reset_password_model.js b/backend/apis/nodejs/src/models/reset_password_model.js index af089cf..7c96df7 100644 --- a/backend/apis/nodejs/src/models/reset_password_model.js +++ b/backend/apis/nodejs/src/models/reset_password_model.js @@ -48,7 +48,7 @@ async function resetPassword(password, secret) { // Delete all the requests associated with that e-mail await tr('RequestResetPassword').where({ - email + email: request.email }).del(); }); } diff --git a/backend/apis/nodejs/src/routes/reset_password_routes.js b/backend/apis/nodejs/src/routes/reset_password_routes.js index f4e582f..291359d 100644 --- a/backend/apis/nodejs/src/routes/reset_password_routes.js +++ b/backend/apis/nodejs/src/routes/reset_password_routes.js @@ -44,8 +44,8 @@ async function reset(req, res) { const diffMilliseconds = Date.now() - requester.time_of_request.getTime(); // Check whether the request was not performed more than 30 minutes ago if (diffMilliseconds / (1000 * 60) <= 30) { - const newPassword = await bcrypt.hash(req.body.password, 10); - ResetPassword.resetPassword(newPassword, req.body.secret); + const newPassword = await bcrypt.hash(req.body.password.trim(), 10); + await ResetPassword.resetPassword(newPassword, req.body.secret); return res.status(204).send(); } } diff --git a/frontend/vanilla/html/reset-password.html b/frontend/vanilla/html/reset-password.html index 21bd3e9..acf022f 100644 --- a/frontend/vanilla/html/reset-password.html +++ b/frontend/vanilla/html/reset-password.html @@ -8,12 +8,11 @@ -
-