Skip to content

Commit

Permalink
Improve login behavior (#234)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cito authored Jul 26, 2024
1 parent 95a4880 commit f35145d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/components/confirm2FA/confirm2FA.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -242,7 +244,10 @@ const Confirm2FA = () => {
</div>
</form>
</div>
<Modal show={blocked && blocker.state === "blocked"} onHide={stay}>
<Modal
show={!has2fa && blocked && blocker.state === "blocked"}
onHide={stay}
>
<Modal.Header closeButton>
<Modal.Title>You have not setup 2FA yet!</Modal.Title>
</Modal.Header>
Expand Down
4 changes: 4 additions & 0 deletions src/services/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit f35145d

Please sign in to comment.