mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
core: fix oauth id
This commit is contained in:
4 files changed
+15
-3
No files matched your search
@@ -603,4 +603,16 @@ export const coreScripts: MigrationScript[] = [
|
||||
});
|
||||
return true;
|
||||
},
|
||||
async function _93_94(ctx) {
|
||||
await ctx.inject(['oauth'], async (c) => {
|
||||
await c.oauth.coll.deleteMany({ _id: { $type: 'string' } });
|
||||
const docs = await c.oauth.coll.find({ id: { $type: 'number' as any } }).toArray();
|
||||
const op = c.oauth.coll.initializeUnorderedBulkOp();
|
||||
for (const doc of docs) {
|
||||
op.find({ _id: doc._id }).updateOne({ id: doc.id.toString() });
|
||||
}
|
||||
if (op.length) await op.execute();
|
||||
});
|
||||
return true;
|
||||
},
|
||||
];
|
||||
@@ -47,7 +47,7 @@ export default class LoginWithGithubService extends Service {
|
||||
.set('Accept', 'application/vnd.github.v3+json')
|
||||
.set('Authorization', `token ${t}`);
|
||||
const ret = {
|
||||
_id: userInfo.body.id,
|
||||
_id: userInfo.body.id.toString(),
|
||||
email: userInfo.body.email,
|
||||
bio: userInfo.body.bio,
|
||||
uname: [userInfo.body.name, userInfo.body.login].filter((i) => i),
|
||||
|
||||
@@ -60,7 +60,7 @@ export default class GoogleOAuthService extends Service {
|
||||
await TokenModel.del(state, TokenModel.TYPE_OAUTH);
|
||||
this.response.redirect = s.redirect;
|
||||
return {
|
||||
_id: payload.sub,
|
||||
_id: payload.sub.toString(),
|
||||
email: payload.email,
|
||||
uname: [`${payload.given_name} ${payload.family_name}`, payload.name],
|
||||
viewLang: payload.locale.replace('-', '_'),
|
||||
|
||||
@@ -40,7 +40,7 @@ export default class TelegramService extends Service {
|
||||
id, first_name, last_name, username, photo_url,
|
||||
} = parsed;
|
||||
const ret = {
|
||||
_id: id,
|
||||
_id: id.toString(),
|
||||
email: `${id}@telegram.local`,
|
||||
bio: '',
|
||||
uname: [`${first_name} ${last_name}`, username, `telegram${id.toString()}`].filter((i) => i),
|
||||
|
||||
Reference in new issue
Block a user