Postgres
This commit is contained in:
@@ -7,7 +7,7 @@ const authClient = createAuthClient({
|
||||
// Keep auth requests on the current origin (important for tenant subdomains).
|
||||
baseURL: typeof window !== 'undefined'
|
||||
? window.location.origin
|
||||
: (process.env.NEXT_PUBLIC_APP_URL ?? 'http://localhost:3032'),
|
||||
: (process.env.NEXT_PUBLIC_APP_URL ?? 'http://localhost:3010'),
|
||||
})
|
||||
|
||||
interface LoginFormProps {
|
||||
@@ -52,7 +52,25 @@ export function LoginForm({ primaryColor = '#C99738' }: LoginFormProps) {
|
||||
// mustChangePassword is handled by the dashboard ForcePasswordChange component
|
||||
const params = new URLSearchParams(window.location.search)
|
||||
const callbackUrl = params.get('callbackUrl')
|
||||
window.location.href = callbackUrl || '/dashboard'
|
||||
|
||||
let target = '/dashboard'
|
||||
if (callbackUrl?.startsWith('/')) {
|
||||
target = callbackUrl
|
||||
|
||||
// Normalize stale tenant-prefixed callback URLs like /test/dashboard
|
||||
// when already on the tenant subdomain test.localhost.
|
||||
const hostname = window.location.hostname
|
||||
const parts = hostname.split('.')
|
||||
const isTenantSubdomain =
|
||||
parts.length > 2 || (parts.length === 2 && parts[1] === 'localhost')
|
||||
const tenantSlug = isTenantSubdomain ? parts[0] : null
|
||||
|
||||
if (tenantSlug && target.startsWith(`/${tenantSlug}/`)) {
|
||||
target = target.slice(tenantSlug.length + 1) || '/dashboard'
|
||||
}
|
||||
}
|
||||
|
||||
window.location.href = target
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user