fix: refs #6744 drop to set emailVerified
gitea/salix/pipeline/pr-dev This commit looks good
Details
gitea/salix/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
parent
1658838c87
commit
c79bdeb3f4
|
@ -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);
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue