improve recent logout information

This commit is contained in:
kritzl 2026-05-11 20:55:58 +02:00
commit bcfcf264f6
Signed by: kritzl
SSH key fingerprint: SHA256:5BmINP9VjZWaUk5Z+2CTut1KFhwLtd0ZynMekKbtViM
3 changed files with 22 additions and 13 deletions

View file

@ -38,8 +38,9 @@ const {id, classList = "", color = "info", title, description} = Astro.props
<TriangleAlert class="size-7"/> <TriangleAlert class="size-7"/>
)} )}
</slot> </slot>
<div class="flex flex-col gap-2"> <div class="flex flex-col gap-2 w-full">
<span>{title}</span> <span>{title}</span>
<span class="text-sm opacity-90 mt-1" set:html={description}/> <span class="text-sm opacity-90 mt-1" set:html={description}/>
<slot></slot>
</div> </div>
</div> </div>

View file

@ -26,8 +26,8 @@ export const ui = {
"button.close": "Close", "button.close": "Close",
"login": "Login", "login": "Login",
"loggedOut.title": "Signed out", "loggedOut.title": "Signed out",
"loggedOut.description": `Your Session is expired and you were logged out. "loggedOut.description": `Your session has expired and you have been logged out.<br>
Log in again: <a class='underline' href='/auth/login'>Login</a>`, Please log in again.`,
"serverError.title": "Server Error", "serverError.title": "Server Error",
"serverError.description": `Please try again later.`, "serverError.description": `Please try again later.`,
}, },
@ -51,8 +51,8 @@ export const ui = {
"button.close": "Schließen", "button.close": "Schließen",
"login": "Anmelden", "login": "Anmelden",
"loggedOut.title": "Abgemeldet", "loggedOut.title": "Abgemeldet",
"loggedOut.description": `Deine Sitzung ist abgelaufen und du wurdest abgemeldet. "loggedOut.description": `Deine Sitzung ist abgelaufen und du wurdest abgemeldet.<br>
Melde dich hier erneut an: <a class='underline' href='/auth/login'>Anmelden</a>`, Melde dich erneut an.`,
"serverError.title": "Serverfehler", "serverError.title": "Serverfehler",
"serverError.description": `Bitte versuche es später erneut.`, "serverError.description": `Bitte versuche es später erneut.`,
}, },

View file

@ -89,6 +89,7 @@ const t = useTranslations(lang)
const error = e.getActualType() const error = e.getActualType()
if (error.status === 401) { if (error.status === 401) {
if (!auth.recentLogout)
auth.recentLogout = auth.authenticated // set recentLogout true, if user was logged in before auth.recentLogout = auth.authenticated // set recentLogout true, if user was logged in before
auth.authenticated = false auth.authenticated = false
auth.authorized = false auth.authorized = false
@ -237,6 +238,20 @@ const t = useTranslations(lang)
</script> </script>
</Fragment> </Fragment>
<div class="grid place-items-center grid-cols-1 gap-4 max-w-xl mx-auto" id="list"> <div class="grid place-items-center grid-cols-1 gap-4 max-w-xl mx-auto" id="list">
<Alert
classList="hidden"
id="alert-loggedout"
color="warning"
title={t("loggedOut.title")}
description={t("loggedOut.description")}
>
<div class="flex justify-end">
<a href="/auth/login" class="btn btn-sm btn-warning">
<LogIn/>
{t("login")}
</a>
</div>
</Alert>
<Alert <Alert
classList="hidden" classList="hidden"
id="alert-unauthenticated" id="alert-unauthenticated"
@ -259,13 +274,6 @@ const t = useTranslations(lang)
<Lock class="size-7"/> <Lock class="size-7"/>
</Fragment> </Fragment>
</Alert> </Alert>
<Alert
classList="hidden"
id="alert-loggedout"
color="warning"
title={t("loggedOut.title")}
description={t("loggedOut.description")}
/>
<Alert <Alert
classList="hidden" classList="hidden"
id="alert-serverError" id="alert-serverError"