This commit is contained in:
@@ -54,6 +54,8 @@ export class LoginComponent implements OnInit {
|
||||
private static readonly MAX_REDIRECT_COUNT = 3;
|
||||
|
||||
ngOnInit(): void {
|
||||
this.authService.clearSessionOnLoginPage();
|
||||
|
||||
this.route.queryParams.pipe(take(1)).subscribe(params => {
|
||||
if (params['reason'] === 'session_revoked') {
|
||||
this.infoMessage = this.translocoService.translate('auth.login.sessionRevoked');
|
||||
|
||||
@@ -77,10 +77,10 @@ export class AuthService {
|
||||
const refreshToken = this.getInternalRefreshToken();
|
||||
this.http.post<{ logoutUrl: string | null }>(`${this.apiUrl}/logout`, {refreshToken}).subscribe({
|
||||
next: (response) => {
|
||||
this.clearSession();
|
||||
if (response.logoutUrl) {
|
||||
window.location.href = response.logoutUrl;
|
||||
} else {
|
||||
this.clearSession();
|
||||
this.router.navigate(['/login']).then(() => window.location.reload());
|
||||
}
|
||||
},
|
||||
@@ -96,6 +96,10 @@ export class AuthService {
|
||||
this.router.navigate(['/login'], {queryParams: {reason}});
|
||||
}
|
||||
|
||||
clearSessionOnLoginPage(): void {
|
||||
this.clearSession();
|
||||
}
|
||||
|
||||
private clearSession(): void {
|
||||
localStorage.removeItem('accessToken_Internal');
|
||||
localStorage.removeItem('refreshToken_Internal');
|
||||
|
||||
Reference in New Issue
Block a user