mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: fix change language
This commit is contained in:
1 parent
5b9601f8c3
commit
b776155993
4 files changed
+9
-4
No files matched your search
@@ -253,6 +253,7 @@ class HomeSettingsHandler extends Handler {
|
||||
}
|
||||
for (const key in booleanKeys) if (!args[key]) $set[key] = false;
|
||||
await setter($set);
|
||||
if (args.viewLang && args.viewLang !== this.session.viewLang) this.session.viewLang = '';
|
||||
this.back();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,6 +83,7 @@ class UserLoginHandler extends Handler {
|
||||
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);
|
||||
this.session.viewLang = '';
|
||||
this.session.uid = udoc._id;
|
||||
this.session.scope = PERM.PERM_ALL.toString();
|
||||
this.session.save = rememberme;
|
||||
@@ -175,7 +176,11 @@ class UserRegisterWithCodeHandler extends Handler {
|
||||
const uid = await user.create(tdoc.mail, uname, password, undefined, this.request.ip);
|
||||
await token.del(code, token.TYPE_REGISTRATION);
|
||||
const [id, domain] = tdoc.mail.split('@');
|
||||
if (domain === 'qq.com' && !Number.isNaN(+id)) await user.setById(uid, { avatar: `qq:${id}` });
|
||||
const $set: any = {};
|
||||
if (domain === 'qq.com' && !Number.isNaN(+id)) $set.avatar = `qq:${id}`;
|
||||
if (this.session.viewLang) $set.viewLang = this.session.viewLang;
|
||||
if (Object.keys($set).length) await user.setById(uid, $set);
|
||||
this.session.viewLang = '';
|
||||
this.session.uid = uid;
|
||||
this.session.scpoe = PERM.PERM_ALL.toString();
|
||||
this.response.redirect = this.url('home_settings', { category: 'preference' });
|
||||
|
||||
Reference in new issue
Block a user