From f35145d728c3b580aec9b38e4e2a811638c3f613 Mon Sep 17 00:00:00 2001 From: Christoph Zwerschke Date: Fri, 26 Jul 2024 20:19:26 +0200 Subject: [PATCH] Improve login behavior (#234) --- src/components/confirm2FA/confirm2FA.tsx | 7 ++++++- src/services/auth.ts | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/components/confirm2FA/confirm2FA.tsx b/src/components/confirm2FA/confirm2FA.tsx index d9e30c7..1d97057 100644 --- a/src/components/confirm2FA/confirm2FA.tsx +++ b/src/components/confirm2FA/confirm2FA.tsx @@ -109,6 +109,8 @@ const Confirm2FA = () => { unblock(); back(); } else { + const has2fa = /HasTotpToken|Authenticated/.test(user?.state); + const Lost2FAModal = (props: any) => { const [disabledNew2FAButton, setDisabledNew2FAButton] = useState(true); return ( @@ -242,7 +244,10 @@ const Confirm2FA = () => { - + You have not setup 2FA yet! diff --git a/src/services/auth.ts b/src/services/auth.ts index e92d601..c793254 100644 --- a/src/services/auth.ts +++ b/src/services/auth.ts @@ -73,6 +73,10 @@ class AuthService { const settings = this.settings; this.userManager = new UserManager(settings); + // reset the user to force-fetch it via the session + // (may have been logged out in another session or due to timeout) + this.setUser(null); + Log.setLogger(console); Log.setLevel(Log.INFO); // set to DEBUG for more output }