Some checks failed
CI / Unit & Component Tests (push) Successful in 2m7s
CI / Backend Unit Tests (push) Successful in 2m3s
CI / E2E Tests (push) Failing after 14m54s
CI / Unit & Component Tests (pull_request) Successful in 2m4s
CI / E2E Tests (pull_request) Has been cancelled
CI / Backend Unit Tests (pull_request) Has been cancelled
- /forgot-password: email form → sends POST /api/auth/forgot-password → success banner - /reset-password: password form reads token from URL → sends POST /api/auth/reset-password - Login page: add "Passwort vergessen?" link - hooks.server.ts: add /forgot-password and /reset-password to PUBLIC_PATHS; skip auth injection for public auth API endpoints - errors.ts: add INVALID_RESET_TOKEN error code - i18n: add all new message keys in de/en/es - playwright.config.ts: use E2E_BASE_URL for webServer check URL (allows reusing docker dev server at port 5173 locally) - ci.yml: pass E2E_BACKEND_URL=http://localhost:8080 to E2E test step - e2e/password-reset.spec.ts: 5 tests (4 pass locally, full flow requires e2e profile in CI) - Regenerated OpenAPI types including new /api/auth/* endpoints Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
35 lines
1.0 KiB
TypeScript
35 lines
1.0 KiB
TypeScript
import { fail } from '@sveltejs/kit';
|
|
import type { Actions, PageServerLoad } from './$types';
|
|
import { createApiClient } from '$lib/api.server';
|
|
import { parseBackendError } from '$lib/errors';
|
|
|
|
export const load: PageServerLoad = async ({ url }) => {
|
|
const token = url.searchParams.get('token');
|
|
return { token };
|
|
};
|
|
|
|
export const actions = {
|
|
default: async ({ request, fetch }) => {
|
|
const formData = await request.formData();
|
|
const token = formData.get('token') as string;
|
|
const newPassword = formData.get('newPassword') as string;
|
|
const confirmPassword = formData.get('confirmPassword') as string;
|
|
|
|
if (newPassword !== confirmPassword) {
|
|
return fail(400, { error: 'MISMATCH' });
|
|
}
|
|
|
|
const api = createApiClient(fetch);
|
|
const result = await api.POST('/api/auth/reset-password', {
|
|
body: { token, newPassword }
|
|
});
|
|
|
|
if (!result.response.ok) {
|
|
const backendError = await parseBackendError(result.response);
|
|
return fail(400, { error: backendError?.code ?? 'INTERNAL_ERROR' });
|
|
}
|
|
|
|
return { success: true };
|
|
}
|
|
} satisfies Actions;
|