fixes login page in tenant admin pwa

This commit is contained in:
Codex Agent
2025-11-07 13:52:29 +01:00
parent 253239455b
commit f3c44be76d
9 changed files with 156 additions and 21 deletions

View File

@@ -51,6 +51,10 @@ async function exchangeSessionForToken(): Promise<{ token: string; abilities: st
credentials: 'same-origin',
});
if (response.status === 204) {
return null;
}
if (!response.ok) {
return null;
}

View File

@@ -92,7 +92,7 @@ export function DevTenantSwitcher() {
</button>
</div>
<p className="text-xs text-amber-700">
Select a seeded tenant to mint OAuth tokens and jump straight into their admin space. Available only in development builds.
Select a seeded tenant to mint Sanctum PATs and jump straight into their admin space. Available only in development builds.
</p>
<div className="space-y-1">
{DEV_TENANT_KEYS.map(({ key, label }) => (

View File

@@ -10,11 +10,11 @@
"Erstelle Einladungen mit personalisierten QR-Codes und teile sie sofort.",
"Steuere Aufgaben, Emotionen und Slideshows direkt vom Event aus."
],
"lead": "Du meldest dich über unseren sicheren OAuth-Login an und landest direkt im Event-Dashboard.",
"lead": "Du meldest dich über unser gesichertes Fotospiel-Login an und landest direkt im Event-Dashboard.",
"panel_title": "Melde dich an",
"panel_copy": "Logge dich mit deinem Fotospiel-Adminzugang ein. Wir schützen dein Konto mit OAuth 2.1 und klaren Rollenrechten.",
"panel_copy": "Logge dich mit deinem Fotospiel-Adminzugang ein. Wir schützen dein Konto mit persönlichen Zugriffstokens und klaren Rollenrechten.",
"actions_title": "Wähle deine Anmeldemethode",
"actions_copy": "Greife sicher per OAuth oder mit deinem Google-Konto auf das Tenant-Dashboard zu.",
"actions_copy": "Greife sicher mit deinem Fotospiel-Login oder deinem Google-Konto auf das Tenant-Dashboard zu.",
"cta": "Mit Fotospiel-Login fortfahren",
"google_cta": "Mit Google anmelden",
"open_account_login": "Konto-Login öffnen",

View File

@@ -10,11 +10,11 @@
"Create invites with personalized QR codes and share them instantly.",
"Run tasks, emotions, and slideshows right from the event dashboard."
],
"lead": "Use our secure OAuth login and land directly in the event dashboard.",
"lead": "Use our secure Fotospiel login and land directly in the event dashboard.",
"panel_title": "Sign in",
"panel_copy": "Sign in with your Fotospiel admin access. OAuth 2.1 and clear role permissions keep your account protected.",
"panel_copy": "Sign in with your Fotospiel admin access. Sanctum personal access tokens and clear role permissions keep your account protected.",
"actions_title": "Choose your sign-in method",
"actions_copy": "Access the tenant dashboard securely with OAuth or your Google account.",
"actions_copy": "Access the tenant dashboard securely with your Fotospiel login or your Google account.",
"cta": "Continue with Fotospiel login",
"google_cta": "Continue with Google",
"open_account_login": "Open account login",

View File

@@ -86,6 +86,8 @@ export default function LoginPage(): JSX.Element {
},
});
const isSubmitting = (mutation as { isPending?: boolean; isLoading: boolean }).isPending ?? mutation.isLoading;
const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault();
setError(null);
@@ -164,11 +166,21 @@ export default function LoginPage(): JSX.Element {
<Button
type="submit"
className="mt-2 h-12 w-full justify-center rounded-xl bg-gradient-to-r from-[#ff5f87] via-[#ec4899] to-[#6366f1] text-base font-semibold shadow-[0_18px_35px_-18px_rgba(236,72,153,0.7)] transition hover:from-[#ff4470] hover:via-[#ec4899] hover:to-[#4f46e5]"
disabled={mutation.isLoading}
className={`mt-2 h-12 w-full justify-center rounded-xl bg-gradient-to-r from-[#ff5f87] via-[#ec4899] to-[#6366f1] text-base font-semibold shadow-[0_18px_35px_-18px_rgba(236,72,153,0.7)] transition hover:from-[#ff4470] hover:via-[#ec4899] hover:to-[#4f46e5] ${
isSubmitting ? 'cursor-wait opacity-90 saturate-75 shadow-none' : ''
}`}
disabled={isSubmitting}
aria-live="polite"
aria-busy={isSubmitting}
data-loading={isSubmitting ? 'true' : undefined}
>
{mutation.isLoading ? <Loader2 className="mr-2 h-5 w-5 animate-spin" /> : null}
{mutation.isLoading ? t('login.loading', 'Anmeldung …') : t('login.submit', 'Anmelden')}
<span className="flex w-full items-center justify-center gap-2">
<Loader2
className={`h-5 w-5 text-white transition-opacity ${isSubmitting ? 'animate-spin opacity-100' : 'opacity-0'}`}
aria-hidden={!isSubmitting}
/>
<span>{isSubmitting ? t('login.loading', 'Anmeldung …') : t('login.submit', 'Anmelden')}</span>
</span>
</Button>
</form>