global update and global fix
This commit is contained in:
@@ -82,6 +82,16 @@ export default function LoginPage() {
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
const finishLoginRedirect = useCallback(() => {
|
||||
const redirectAfterLogin =
|
||||
typeof window !== 'undefined' ? new URLSearchParams(window.location.search).get('redirect') : null;
|
||||
if (redirectAfterLogin && redirectAfterLogin.startsWith('/')) {
|
||||
router.push(redirectAfterLogin);
|
||||
return;
|
||||
}
|
||||
router.push('/');
|
||||
}, [router]);
|
||||
|
||||
const { identifyLogin, sendLoginOtp, verifyLoginOtp, loginWithPassword, loginWithLdap, beginTotpLogin, verifyTotpLogin, completePin, applyLoginAuth } = useAuth();
|
||||
|
||||
const { showToast } = useToast();
|
||||
@@ -174,7 +184,7 @@ export default function LoginPage() {
|
||||
|
||||
} else {
|
||||
|
||||
router.push('/');
|
||||
finishLoginRedirect();
|
||||
|
||||
}
|
||||
|
||||
@@ -596,7 +606,7 @@ export default function LoginPage() {
|
||||
|
||||
await completePin(pendingSessionId, pin);
|
||||
|
||||
router.push('/');
|
||||
finishLoginRedirect();
|
||||
|
||||
} catch (error) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user