Three root causes fixed: 1. CSRF blocked all backend POSTs — Spring Security's CSRF filter ran before permitAll() authorization, returning 401 for signup and login. Disabled CSRF since SvelteKit is the only client (never the browser directly) and handles its own CSRF via Origin header checks. 2. Login/signup didn't establish Spring Security authentication — they stored email in the HTTP session manually but never set the SecurityContext, so Principal in /v1/auth/me was always null and hooks.server.ts redirected every authenticated request to /login. Fixed with authenticateInSession() helper that sets and persists the SecurityContext under SPRING_SECURITY_CONTEXT_KEY. Login also now invalidates the old session before creating a new one to prevent session fixation. 3. redirect() missing throw in hooks.server.ts, signup action, and login action — SvelteKit never saw the redirect, so pages silently reloaded with no navigation. Also forward JSESSIONID from backend response to browser explicitly, since SvelteKit does not auto-forward Set-Cookie for cross-origin server-side fetches. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
21 lines
555 B
Svelte
21 lines
555 B
Svelte
<script lang="ts">
|
|
import BrandPanel from '$lib/auth/BrandPanel.svelte';
|
|
import SignupForm from '$lib/auth/SignupForm.svelte';
|
|
|
|
let { form } = $props();
|
|
</script>
|
|
|
|
<svelte:head>
|
|
<title>Konto erstellen — Mealprep</title>
|
|
</svelte:head>
|
|
|
|
<!-- Mobile: stacked, Desktop: side by side -->
|
|
<div class="flex min-h-screen flex-col md:flex-row">
|
|
<BrandPanel />
|
|
<div class="flex flex-1 flex-col items-center justify-center px-[20px] py-[24px] md:px-[56px] md:py-[48px]">
|
|
<div class="w-full max-w-[380px]">
|
|
<SignupForm {form} />
|
|
</div>
|
|
</div>
|
|
</div>
|