add validate callback loading state and encryption

This commit is contained in:
miloschwartz
2025-04-14 20:56:45 -04:00
parent 53be2739bb
commit aa3b527f67
11 changed files with 155 additions and 22 deletions

View File

@@ -9,10 +9,10 @@ const patterns: PatternConfig[] = [
{ name: "Resource Auth Portal", regex: /^\/auth\/resource\/\d+$/ }
];
export function cleanRedirect(input: string): string {
export function cleanRedirect(input: string, fallback?: string): string {
if (!input || typeof input !== "string") {
return "/";
}
const isAccepted = patterns.some((pattern) => pattern.regex.test(input));
return isAccepted ? input : "/";
return isAccepted ? input : fallback || "/";
}