feat: add support for email verification

This commit is contained in:
Elias Schneider
2026-01-10 23:11:54 +01:00
parent 811e8772b6
commit 7d71191902
53 changed files with 1341 additions and 667 deletions

View File

@@ -2,7 +2,8 @@ import type { User } from '$lib/types/user.type';
// Returns the path to redirect to based on the current path and user authentication status
// If no redirect is needed, it returns null
export function getAuthRedirectPath(path: string, user: User | null) {
export function getAuthRedirectPath(url: URL, user: User | null) {
const path = url.pathname;
const isSignedIn = !!user;
const isAdmin = user?.isAdmin;
@@ -19,7 +20,8 @@ export function getAuthRedirectPath(path: string, user: User | null) {
const isAdminPath = path == '/settings/admin' || path.startsWith('/settings/admin/');
if (!isUnauthenticatedOnlyPath && !isPublicPath && !isSignedIn) {
return '/login';
const redirect = url.pathname + url.search;
return `/login?redirect=${encodeURIComponent(redirect)}`;
}
if (isUnauthenticatedOnlyPath && isSignedIn) {