From 71dd7f89e92e285775b602d1e1908a82bb8560ae Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 9 Feb 2023 10:47:03 +0900 Subject: [PATCH] clean up --- .../backend/src/server/api/SigninService.ts | 26 +++++-------------- packages/frontend/src/account.ts | 2 -- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/packages/backend/src/server/api/SigninService.ts b/packages/backend/src/server/api/SigninService.ts index 655bf51a1..c78d9f85c 100644 --- a/packages/backend/src/server/api/SigninService.ts +++ b/packages/backend/src/server/api/SigninService.ts @@ -25,7 +25,7 @@ export class SigninService { } @bindThis - public signin(request: FastifyRequest, reply: FastifyReply, user: ILocalUser, redirect = false) { + public signin(request: FastifyRequest, reply: FastifyReply, user: ILocalUser) { setImmediate(async () => { // Append signin history const record = await this.signinsRepository.insert({ @@ -41,25 +41,11 @@ export class SigninService { this.globalEventService.publishMainStream(user.id, 'signin', await this.signinEntityService.pack(record)); }); - if (redirect) { - //#region Cookie - reply.setCookie('igi', user.token!, { - path: '/', - // SEE: https://github.com/koajs/koa/issues/974 - // When using a SSL proxy it should be configured to add the "X-Forwarded-Proto: https" header - secure: this.config.url.startsWith('https'), - httpOnly: false, - }); - //#endregion - - reply.redirect(this.config.url); - } else { - reply.code(200); - return { - id: user.id, - i: user.token, - }; - } + reply.code(200); + return { + id: user.id, + i: user.token, + }; } } diff --git a/packages/frontend/src/account.ts b/packages/frontend/src/account.ts index 31c125d3a..610212b6e 100644 --- a/packages/frontend/src/account.ts +++ b/packages/frontend/src/account.ts @@ -61,8 +61,6 @@ export async function signout() { } catch (err) {} //#endregion - document.cookie = 'igi=; path=/'; - if (accounts.length > 0) login(accounts[0].token); else unisonReload('/'); }