Auth logout URL, auth proxy

This commit is contained in:
binwiederhier
2026-01-22 20:19:59 -05:00
parent 46cb9f2b41
commit b67ffa4f5f
11 changed files with 104 additions and 35 deletions
+22 -6
View File
@@ -139,6 +139,17 @@ const ProfileIcon = () => {
};
const handleLogout = async () => {
// For proxy auth, redirect to the logout URL if configured
if (config.auth_mode === "proxy") {
if (config.auth_logout_url) {
await db().delete();
localStorage.removeItem("user");
localStorage.removeItem("token");
window.location.href = config.auth_logout_url;
}
return;
}
// Standard logout
try {
await accountApi.logout();
await db().delete();
@@ -147,6 +158,9 @@ const ProfileIcon = () => {
}
};
// Determine if logout button should be shown
const showLogout = config.auth_mode !== "proxy" || config.auth_logout_url;
return (
<>
{session.exists() && (
@@ -178,12 +192,14 @@ const ProfileIcon = () => {
</ListItemIcon>
{t("action_bar_profile_settings")}
</MenuItem>
<MenuItem onClick={handleLogout}>
<ListItemIcon>
<Logout fontSize="small" />
</ListItemIcon>
{t("action_bar_profile_logout")}
</MenuItem>
{showLogout && (
<MenuItem onClick={handleLogout}>
<ListItemIcon>
<Logout fontSize="small" />
</ListItemIcon>
{t("action_bar_profile_logout")}
</MenuItem>
)}
</PopupMenu>
</>
);
+8 -1
View File
@@ -1,5 +1,5 @@
import * as React from "react";
import { useState } from "react";
import { useState, useEffect } from "react";
import { Typography, TextField, Button, Box, IconButton, InputAdornment } from "@mui/material";
import WarningAmberIcon from "@mui/icons-material/WarningAmber";
import { NavLink } from "react-router-dom";
@@ -18,6 +18,13 @@ const Login = () => {
const [password, setPassword] = useState("");
const [showPassword, setShowPassword] = useState(false);
// Redirect to app if using proxy authentication
useEffect(() => {
if (config.auth_mode === "proxy") {
window.location.href = routes.app;
}
}, []);
const handleSubmit = async (event) => {
event.preventDefault();
const user = { username, password };