7152-devToTest_2414 #2228

Merged
alexm merged 636 commits from 7152-devToTest_2414 into test 2024-03-28 08:26:34 +00:00
1 changed files with 2 additions and 3 deletions
Showing only changes of commit c79bdeb3f4 - Show all commits

View File

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