mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: 为使用qq邮箱注册的用户自动配置头像
This commit is contained in:
1 parent
c09b4acfd5
commit
57810d7012
2 files changed
+4
-2
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "2.27.5",
|
||||
"version": "2.27.6",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "dist/loader.js",
|
||||
"typings": "dist/loader.d.ts",
|
||||
|
||||
@@ -126,9 +126,11 @@ class UserRegisterWithCodeHandler extends Handler {
|
||||
if (tdoc.phone) tdoc.mail = `${tdoc.phone}@hydro.local`;
|
||||
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}` });
|
||||
this.session.uid = uid;
|
||||
this.session.scpoe = PERM.PERM_ALL.toString();
|
||||
this.response.redirect = this.url('homepage');
|
||||
this.response.redirect = this.url('home_settings', { category: 'preference' });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user