mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Replace basic auth with cookie authentication (#440)
* Add logout functionality and button * Make session age configurable
This commit is contained in:
@@ -4,6 +4,7 @@ import { Nav, Navbar, Button } from "react-bootstrap";
|
||||
import { IconName } from "@fortawesome/fontawesome-svg-core";
|
||||
import { LinkContainer } from "react-router-bootstrap";
|
||||
import { Link, useLocation } from "react-router-dom";
|
||||
import { SessionUtils } from "src/utils";
|
||||
|
||||
import { Icon } from "src/components/Shared";
|
||||
|
||||
@@ -98,6 +99,16 @@ export const MainNavbar: React.FC = () => {
|
||||
</LinkContainer>
|
||||
);
|
||||
|
||||
function maybeRenderLogout() {
|
||||
if (SessionUtils.isLoggedIn()) {
|
||||
return (
|
||||
<Button className="minimal logout-button" href="/logout">
|
||||
<Icon icon="sign-out-alt" />
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<Navbar
|
||||
collapseOnSelect
|
||||
@@ -153,6 +164,7 @@ export const MainNavbar: React.FC = () => {
|
||||
<Icon icon="cog" />
|
||||
</Button>
|
||||
</LinkContainer>
|
||||
{maybeRenderLogout()}
|
||||
</Nav>
|
||||
</Navbar>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user