Skip to content

Commit

Permalink
fix(login): fix bad login redirection (#3305)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacquesfize authored Jan 7, 2025
1 parent a5a65c1 commit 5024a2f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions frontend/src/app/services/unauthorized.interceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
import { Observable, throwError } from 'rxjs';
import 'rxjs/add/operator/catch';
import 'rxjs/add/observable/empty';
import { replace } from '@librairies/cypress/types/lodash';

@Injectable()
export class UnauthorizedInterceptor implements HttpInterceptor {
Expand All @@ -20,10 +21,11 @@ export class UnauthorizedInterceptor implements HttpInterceptor {
if (err instanceof HttpErrorResponse && err.status === 401) {
// Do not redirect if the url contain login
// recovery password and inscriptio nare under 'login' prefix
if (!document.location.href.split('/').includes('login')) {
if (!document.location.href.includes('/login')) {
this.router.navigate(['/login'], {
// TODO: put in config!
queryParams: { route: this.router.url },
queryParams: { next: document.location.href },
replaceUrl: true,
queryParamsHandling: 'merge',
});
}
}
Expand Down

0 comments on commit 5024a2f

Please sign in to comment.