core: async hash calculation (#779)

This commit is contained in:
Yang Gao authored and GitHub committed 2024-04-09 08:13:50 +08:00
1 parent e207cb4194
commit e9a1ece808
5 files changed
+20 -14

No files matched your search

+4 -4
View File
@@ -216,8 +216,8 @@ class HomeSecurityHandler extends Handler {
if (this.session.sudoUid) {
const udoc = await user.getById(domainId, this.session.sudoUid);
if (!udoc) throw new UserNotFoundError(this.session.sudoUid);
udoc.checkPassword(current);
} else this.user.checkPassword(current);
await udoc.checkPassword(current);
} else await this.user.checkPassword(current);
await user.setPassword(this.user._id, password);
await token.delByUid(this.user._id);
this.response.redirect = this.url('user_login');
@@ -232,8 +232,8 @@ class HomeSecurityHandler extends Handler {
if (this.session.sudoUid) {
const udoc = await user.getById(domainId, this.session.sudoUid);
if (!udoc) throw new UserNotFoundError(this.session.sudoUid);
udoc.checkPassword(current);
} else this.user.checkPassword(current);
await udoc.checkPassword(current);
} else await this.user.checkPassword(current);
const udoc = await user.getByEmail(domainId, email);
if (udoc) throw new UserAlreadyExistError(email);
await this.limitRate('send_mail', 3600, 30);
+3 -3
View File
@@ -117,7 +117,7 @@ class UserLoginHandler extends Handler {
await token.del(authnChallenge, token.TYPE_WEBAUTHN);
} else throw new ValidationError('2FA', 'Authn');
}
udoc.checkPassword(password);
await udoc.checkPassword(password);
await user.setById(udoc._id, { loginat: new Date(), loginip: this.request.ip });
if (!udoc.hasPriv(PRIV.PRIV_USER_PROFILE)) throw new BlacklistedError(uname, udoc.banReason);
this.session.viewLang = '';
@@ -153,7 +153,7 @@ class UserSudoHandler extends Handler {
await token.del(authnChallenge, token.TYPE_WEBAUTHN);
} else if (this.user.tfa && tfa) {
if (!verifyTFA(this.user._tfa, tfa)) throw new InvalidTokenError('2FA');
} else this.user.checkPassword(password);
} else await this.user.checkPassword(password);
this.session.sudo = Date.now();
if (this.session.sudoArgs.method.toLowerCase() !== 'get') {
this.response.template = 'user_sudo_redirect.html';
@@ -445,7 +445,7 @@ class UserDetailHandler extends Handler {
class UserDeleteHandler extends Handler {
async post({ password }) {
this.user.checkPassword(password);
await this.user.checkPassword(password);
const tid = await ScheduleModel.add({
executeAfter: moment().add(7, 'days').toDate(),
type: 'script',