Update reset_password_model.js

This commit is contained in:
xfarrow 2024-03-25 15:56:44 +01:00
parent dbdc9f78c5
commit 84a7290ebc
1 changed files with 2 additions and 1 deletions

View File

@ -35,7 +35,7 @@ async function findBySecret(secret) {
* @returns * @returns
*/ */
async function resetPassword(password, secret) { async function resetPassword(password, secret) {
const request = await findBySecret(secret); const request = await findBySecret(secret); //TODO should we avoid another db call by directly passing the email?
if (!request) { if (!request) {
return; return;
} }
@ -46,6 +46,7 @@ async function resetPassword(password, secret) {
password password
}); });
// Delete all the requests associated with that e-mail
await tr('RequestResetPassword').where({ await tr('RequestResetPassword').where({
email email
}).del(); }).del();