core: disable 2FA on reset password (#550)

This commit is contained in:
panda authored and GitHub committed 2024-04-20 13:39:05 +08:00
1 parent 10d742fe62
commit 317beeac8d
1 file changed
+1
+1
View File
@@ -384,6 +384,7 @@ class UserLostPassWithCodeHandler extends Handler {
const tdoc = await token.get(code, token.TYPE_LOSTPASS);
if (!tdoc) throw new InvalidTokenError(token.TYPE_TEXTS[token.TYPE_LOSTPASS], code);
if (password !== verifyPassword) throw new VerifyPasswordError();
await user.setById(tdoc.uid, { authenticators: [], tfa: false });
await user.setPassword(tdoc.uid, password);
await token.del(code, token.TYPE_LOSTPASS);
this.response.redirect = this.url('homepage');