core: 为使用qq邮箱注册的用户自动配置头像

This commit is contained in:
undefined committed 2021-05-27 00:10:55 +08:00
1 parent c09b4acfd5
commit 57810d7012
2 files changed
+4 -2

No files matched your search

+3 -1
View File
@@ -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' });
}
}