Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Redirect to login page when authentication validation fails #1757

Merged
merged 1 commit into from
Sep 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,13 @@ export class AuthRedirectComponent implements OnInit {
'Missing nonce or code verifier value',
'The nonce or code verifier value is missing in the session storage. If you initiated the login yourself, please retry, and if the error persists or you did not initiate the login, please contact your system administrator',
);
this.redirectToLogin();
} else if (redirectTo === null) {
this.toastService.showError(
'State mismatch error',
'The state returned by the authentication server does not match the local state. If you initiated the login yourself, please retry, and if the error persists or you did not initiate the login, please contact your system administrator.',
);
this.router.navigateByUrl('/auth');
this.redirectToLogin();
} else {
sessionStorage.removeItem(params.state);
sessionStorage.removeItem(this.authService.SESSION_STORAGE_NONCE_KEY);
Expand All @@ -79,9 +80,13 @@ export class AuthRedirectComponent implements OnInit {
this.userService.updateOwnUser();
this.router.navigateByUrl(redirectTo);
},
error: () => this.router.navigateByUrl('/auth'),
error: () => this.redirectToLogin(),
});
}
});
}

redirectToLogin(): void {
this.router.navigateByUrl('/auth');
}
}
Loading