Skip to content

Commit

Permalink
fix(logout): fix frontend logout function for firefox clients
Browse files Browse the repository at this point in the history
Previous implementation of logout(), with routing to login page after asynchronous request to backend /auth/logout endpoint, would not work on every client.
Also, while still functional on Chrome clients, the previous implementation was weird as one would get redirected to the login page while possibly not yet fully logged out.

This new implementation executes routing to login page after backend logout is done.
  • Loading branch information
VincentCauchois authored and Christophe-Ramet committed Feb 6, 2025
1 parent bf23594 commit d9bc297
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions frontend/src/app/components/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,12 @@ export class AuthService {
this.cruvedService.clearCruved();
// call the logout route to delete the session
this._http.get<any>(`${this.config.API_ENDPOINT}/auth/logout`).subscribe(() => {
location.reload();
if (this.config.CAS_PUBLIC.CAS_AUTHENTIFICATION) {
document.location.href = `${this.config.CAS_PUBLIC.CAS_URL_LOGOUT}?service=${this.config.URL_APPLICATION}`;
} else {
this.router.navigate(['/login']);
}
});

if (this.config.CAS_PUBLIC.CAS_AUTHENTIFICATION) {
document.location.href = `${this.config.CAS_PUBLIC.CAS_URL_LOGOUT}?service=${this.config.URL_APPLICATION}`;
} else {
this.router.navigate(['/login']);
}
}

private cleanLocalStorage() {
Expand Down

0 comments on commit d9bc297

Please sign in to comment.