Skip to content

Commit

Permalink
frontend: only logout current session when clicking the logout button…
Browse files Browse the repository at this point in the history
… in the navbar and add button to logout all sessions to user page.
  • Loading branch information
ffreddow committed Oct 16, 2024
1 parent 113dcc4 commit 2034677
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion frontend/src/components/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export function CustomNavbar() {
<Nav>
<Nav.Link onClick={(e) => {
e.preventDefault();
logout(true);
logout(false);
}}>{t("logout")}</Nav.Link>
</Nav>
</Navbar.Collapse>
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/locales/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ export const de ={
"close": "Schließen",
"delete_user": "Account löschen",
"password": "Passwort",
"password_invalid": "Passwort falsch"
"password_invalid": "Passwort falsch",
"logout_all": "Von allen Geräten ausloggen"
},
"recovery": {
"recovery": "Passwort zurücksetzen",
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ export const en = {
"close": "Close",
"delete_user": "Delete account",
"password": "Password",
"password_invalid": "Password is wrong"
"password_invalid": "Password is wrong",
"logout_all": "Logout from all devices"
},
"recovery": {
"recovery": "Password recovery",
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/pages/user.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,10 @@ export function User() {
<Button variant="primary" className="col col-sm-6 col-md-4 col-lg-3 col-xl-2 mb-3" onClick={handleUpdatePasswordShow}>
{t("change_password")}
</Button>

<Button variant="primary" className="col col-sm-6 col-md-4 col-lg-3 col-xl-2 mb-3" onClick={() => logout(true)}>
{t("logout_all")}
</Button>
<Button variant="danger" className="col col-sm-6 col-md-4 col-lg-3 col-xl-2" onClick={handleDeleteUserShow}>
{t("delete_user")}
</Button>
Expand Down

0 comments on commit 2034677

Please sign in to comment.