diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2020-03-21 13:36:41 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2020-03-21 13:36:41 +0900 |
| commit | 6fb7721798657cf842556fb63f116316365efa74 (patch) | |
| tree | 6917342553156b6483b899eafc66ef8f040b8352 /src/server/api/service/github.ts | |
| parent | Update CHANGELOG.md (diff) | |
| parent | 12.22.0 (diff) | |
| download | misskey-6fb7721798657cf842556fb63f116316365efa74.tar.gz misskey-6fb7721798657cf842556fb63f116316365efa74.tar.bz2 misskey-6fb7721798657cf842556fb63f116316365efa74.zip | |
Merge branch 'develop'
Diffstat (limited to 'src/server/api/service/github.ts')
| -rw-r--r-- | src/server/api/service/github.ts | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/server/api/service/github.ts b/src/server/api/service/github.ts index ec9cce7ad8..e36c43ee38 100644 --- a/src/server/api/service/github.ts +++ b/src/server/api/service/github.ts @@ -13,7 +13,7 @@ import { ILocalUser } from '../../../models/entities/user'; import { ensure } from '../../../prelude/ensure'; function getUserToken(ctx: Koa.Context) { - return ((ctx.headers['cookie'] || '').match(/i=(\w+)/) || [null, null])[1]; + return ((ctx.headers['cookie'] || '').match(/igi=(\w+)/) || [null, null])[1]; } function compareOrigin(ctx: Koa.Context) { @@ -111,14 +111,10 @@ router.get('/signin/github', async ctx => { state: uuid() }; - const expires = 1000 * 60 * 60; // 1h - ctx.cookies.set('signin_with_github_session_id', sessid, { + ctx.cookies.set('signin_with_github_sid', sessid, { path: '/', - domain: config.host, secure: config.url.startsWith('https'), - httpOnly: true, - expires: new Date(Date.now() + expires), - maxAge: expires + httpOnly: true }); redis.set(sessid, JSON.stringify(params)); @@ -133,7 +129,7 @@ router.get('/gh/cb', async ctx => { const oauth2 = await getOath2(); if (!userToken) { - const sessid = ctx.cookies.get('signin_with_github_session_id'); + const sessid = ctx.cookies.get('signin_with_github_sid'); if (!sessid) { ctx.throw(400, 'invalid session'); @@ -192,7 +188,7 @@ router.get('/gh/cb', async ctx => { } const link = await UserProfiles.createQueryBuilder() - .where('"integrations"->"github"->"id" = :id', { id: id }) + .where(`"integrations"->'github'->>'id' = :id`, { id: id }) .andWhere('"userHost" IS NULL') .getOne(); |