mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
core: fix oauth callback with mail only (#1110)
This commit is contained in:
1 parent
f2b79e3ba1
commit
cd94929e20
1 file changed
+8
-1
@@ -476,12 +476,19 @@ class OauthCallbackHandler extends Handler {
|
||||
return;
|
||||
}
|
||||
|
||||
const uid = await this.ctx.oauth.get(args.type, r._id) || await this.ctx.oauth.get('mail', r.email);
|
||||
const uid = await this.ctx.oauth.get(args.type, r._id);
|
||||
if (uid) {
|
||||
await successfulAuth.call(this, await user.getById('system', uid));
|
||||
this.response.redirect = '/';
|
||||
return;
|
||||
}
|
||||
const udoc = await user.getByEmail('system', r.email);
|
||||
if (udoc) {
|
||||
await this.ctx.oauth.set(args.type, r._id, udoc._id);
|
||||
await successfulAuth.call(this, udoc);
|
||||
this.response.redirect = '/';
|
||||
return;
|
||||
}
|
||||
if (!provider.canRegister) throw new ForbiddenError('No binded account found');
|
||||
this.checkPriv(PRIV.PRIV_REGISTER_USER);
|
||||
let username = '';
|
||||
|
||||
Reference in new issue
Block a user