Preserve post-login redirect for customer dashboard deep links.

Unauthenticated visits to protected pages now land on /login?redirect=…, and a shared helper keeps redirect targets same-origin only.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Alireza Hassani
2026-08-10 09:23:45 +03:30
co-authored by Cursor
parent 7374dd9978
commit cce28a4d7c
6 changed files with 35 additions and 34 deletions
+1 -7
View File
@@ -17,19 +17,13 @@ import {
} from '../services/authService'
import { LanguageSelect, PasswordStrengthMeter, isPasswordStrong } from '@meshkee/dashboard-ui'
import { useT } from '../i18n/useT'
import { safeRedirectPath } from '../lib/redirect'
import meshkeeLogo from '../assets/meshkee-logo.png'
import styles from './LoginPage.module.css'
type AuthView = 'login' | 'signup' | 'forgot' | 'otp'
type SmsStep = 'phone' | 'code'
function safeRedirectPath(value: string | null) {
if (!value || !value.startsWith('/') || value.startsWith('//')) {
return '/'
}
return value
}
export function LoginPage() {
const navigate = useNavigate()
const [searchParams] = useSearchParams()