From fc8cfa5419462d3fa06a8048c1c1577fdcd3ad2b Mon Sep 17 00:00:00 2001 From: Paul Makles Date: Wed, 13 Jul 2022 13:05:43 +0100 Subject: [PATCH] fix: actually log out invalidate sessions --- src/controllers/client/ClientController.tsx | 11 ++++++++++- src/controllers/client/Session.tsx | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/controllers/client/ClientController.tsx b/src/controllers/client/ClientController.tsx index fc51c4f6..d5024187 100644 --- a/src/controllers/client/ClientController.tsx +++ b/src/controllers/client/ClientController.tsx @@ -10,6 +10,7 @@ import Auth from "../../mobx/stores/Auth"; import { resetMemberSidebarFetched } from "../../components/navigation/right/MemberSidebar"; import { modalController } from "../modals/ModalController"; import Session from "./Session"; +import { takeError } from "./jsx/error"; /** * Controls the lifecycles of clients @@ -156,12 +157,20 @@ class ClientController { configuration: this.configuration!, knowledge, }) - .catch((error) => { + .catch((err) => { + const error = takeError(err); if (error === "Forbidden" || error === "Unauthorized") { this.sessions.delete(user_id); + this.current = null; + this.pickNextSession(); state.auth.removeSession(user_id); modalController.push({ type: "signed_out" }); session.destroy(); + } else { + modalController.push({ + type: "error", + error, + }); } }); } diff --git a/src/controllers/client/Session.tsx b/src/controllers/client/Session.tsx index f1360e26..7623265e 100644 --- a/src/controllers/client/Session.tsx +++ b/src/controllers/client/Session.tsx @@ -202,7 +202,7 @@ export default class Session { } } - this.continueLogin(data); + await this.continueLogin(data); break; }