From 7f448221ceda4596c5ac0ba2f171f37649d9b156 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 8 Apr 2018 04:44:59 +0900 Subject: Fix bugs --- src/client/app/common/mios.ts | 7 ++++++- src/server/api/private/signin.ts | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/client/app/common/mios.ts b/src/client/app/common/mios.ts index fd267bc3f8..7baf974adf 100644 --- a/src/client/app/common/mios.ts +++ b/src/client/app/common/mios.ts @@ -220,7 +220,7 @@ export default class MiOS extends EventEmitter { public signout() { localStorage.removeItem('me'); - document.cookie = `i=; domain=.${hostname}; expires=Thu, 01 Jan 1970 00:00:01 GMT;`; + document.cookie = `i=; domain=${hostname}; expires=Thu, 01 Jan 1970 00:00:01 GMT;`; location.href = '/'; } @@ -325,6 +325,11 @@ export default class MiOS extends EventEmitter { // キャッシュがあったとき if (cachedMe) { + if (cachedMe.token == null) { + this.signout(); + return; + } + // とりあえずキャッシュされたデータでお茶を濁して(?)おいて、 fetched(cachedMe); diff --git a/src/server/api/private/signin.ts b/src/server/api/private/signin.ts index d7c4832c95..665ee21ebd 100644 --- a/src/server/api/private/signin.ts +++ b/src/server/api/private/signin.ts @@ -49,7 +49,7 @@ export default async (req: express.Request, res: express.Response) => { } // Compare password - const same = await bcrypt.compare(password, password); + const same = await bcrypt.compare(password, user.password); if (same) { if (user.twoFactorEnabled) { -- cgit v1.2.3-freya