From e5e5a5a4ed2e89bbf6f2a962d125c24cfca69aa4 Mon Sep 17 00:00:00 2001 From: patrick Date: Wed, 28 Oct 2026 23:47:00 +0100 Subject: [PATCH] account: nach der Anmeldung direkt ins Portal, gueltige Sitzung ueberspringt das Formular NEXT_PUBLIC_PORTAL_URL ist das Ziel (ohne Wert wie bisher /profile). Das Profil bekommt einen Link zum Portal. Co-Authored-By: Claude Sonnet 5.5 --- web/account/app/login/page.tsx | 14 +++++++++++--- web/account/app/profile/page.tsx | 5 +++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/web/account/app/login/page.tsx b/web/account/app/login/page.tsx index bb540a19..508fc1bf 100644 --- a/web/account/app/login/page.tsx +++ b/web/account/app/login/page.tsx @@ -1,8 +1,12 @@ "use client"; -import { useState } from "react"; +import { useEffect, useState } from "react"; import { TextField, useToast } from "@nexarch/shl"; -import { ApiError, login } from "../../lib/api"; +import { ApiError, fetchMe, login } from "../../lib/api"; + +function goToPortal(): void { + window.location.href = process.env.NEXT_PUBLIC_PORTAL_URL || "/profile"; +} export default function LoginPage() { const { push } = useToast(); @@ -13,6 +17,10 @@ export default function LoginPage() { const [error, setError] = useState(null); const [submitting, setSubmitting] = useState(false); + useEffect(() => { + fetchMe().then(goToPortal).catch(() => {}); + }, []); + async function onSubmit(event: React.FormEvent) { event.preventDefault(); setError(null); @@ -20,7 +28,7 @@ export default function LoginPage() { try { await login(email, password, needsSecondFactor ? totpCode : undefined); push("Anmeldung erfolgreich.", "success"); - window.location.href = "/profile"; + goToPortal(); } catch (err) { if (err instanceof ApiError) { // Akzeptanzkriterium 3 / Pruefung 1: nur die generische, vom Backend diff --git a/web/account/app/profile/page.tsx b/web/account/app/profile/page.tsx index 44d235d0..5b94d1e7 100644 --- a/web/account/app/profile/page.tsx +++ b/web/account/app/profile/page.tsx @@ -39,6 +39,11 @@ export default function ProfilePage() { return (

Mein Profil

+ {process.env.NEXT_PUBLIC_PORTAL_URL && ( +

+ Zum Portal +

+ )} {me && (

Stammdaten

-- 2.47.3