Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

🔒️ Validate redirect url (#2280)

Luke Vellaa58d895eecd9
diff --git a/apps/web/src/app/[locale]/(auth)/reset-password/components/reset-password-form.tsx b/apps/web/src/app/[locale]/(auth)/reset-password/components/reset-password-form.tsx
index 238dc38ca..abf8639c3 100644
--- a/apps/web/src/app/[locale]/(auth)/reset-password/components/reset-password-form.tsx
+++ b/apps/web/src/app/[locale]/(auth)/reset-password/components/reset-password-form.tsx
@@ -18,6 +18,7 @@ import { PasswordStrengthMeter } from "@/features/password/components/password-s
import { usePasswordValidationSchema } from "@/features/password/schema";
import { Trans } from "@/i18n/client";
import { authClient } from "@/lib/auth-client";
+import { validateRedirectUrl } from "@/utils/redirect";
function useResetPasswordSchema() {
const passwordValidation = usePasswordValidationSchema();
@@ -71,15 +72,11 @@ export function ResetPasswordForm() {
return;
}
- // Check if this came from password setup (redirectTo contains settings)
- const redirectTo = searchParams?.get("redirectTo");
- if (redirectTo?.includes("/settings/security")) {
- // For password setup, redirect back to settings
- router.push(redirectTo);
- } else {
- // For password reset, redirect to login
- router.push("/login");
- }
+ const redirectTo = validateRedirectUrl(
+ searchParams?.get("redirectTo"),
+ );
+
+ router.push(redirectTo ?? "/login");
})}
>
<div className="space-y-4">