Admin User nach einer Zeit von einer Stunde löschen (Cookie oder Local Storrage) , automatisch abmelden

This commit is contained in:
ISA
2025-09-08 07:08:59 +02:00
parent c03802e97f
commit 22321a7ac9
7 changed files with 80 additions and 9 deletions

View File

@@ -22,6 +22,12 @@ const UserManagementSettings: React.FC = () => {
() => {
setLoginSuccess(true);
setError("");
// Speichere die System-Uhrzeit (Login-Zeitpunkt) im localStorage
try {
localStorage.setItem("adminLoginTime", new Date().toISOString());
} catch {
// Ignoriere Speicherfehler (z. B. in Private Mode)
}
},
(errorMsg) => {
setLoginSuccess(false);
@@ -47,7 +53,14 @@ const UserManagementSettings: React.FC = () => {
<button
type="button"
className="bg-littwin-blue text-white px-4 py-2 h-8 text-xs rounded whitespace-nowrap"
onClick={logoutAdmin}
onClick={() => {
try {
localStorage.removeItem("adminLoginTime");
} catch {
// ignore
}
logoutAdmin();
}}
>
Admin abmelden
</button>