fix: refs #6744 drop to set emailVerified
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jorge Penadés 2024-02-29 13:41:27 +01:00
parent 1658838c87
commit c79bdeb3f4
1 changed files with 2 additions and 3 deletions

View File

@ -12,10 +12,9 @@ module.exports = Self => {
require('../methods/account/set-password')(Self); require('../methods/account/set-password')(Self);
Self.setUnverifiedPassword = async(id, pass, options) => { Self.setUnverifiedPassword = async(id, pass, options) => {
const user = await models.VnUser.findById(id, null, options); const {emailVerified} = await models.VnUser.findById(id, {fields: ['emailVerified']}, options);
if (user.emailVerified) throw new ForbiddenError('This password can only be changed by the user themselves'); if (emailVerified) throw new ForbiddenError('This password can only be changed by the user themselves');
await models.VnUser.setPassword(id, pass, options); await models.VnUser.setPassword(id, pass, options);
await user.updateAttribute('emailVerified', true, options);
}; };
}; };