diff --git a/client/src/app/+page-not-found/page-not-found.component.html b/client/src/app/+page-not-found/page-not-found.component.html index 70ede26e8327..c6ca8670e5e5 100644 --- a/client/src/app/+page-not-found/page-not-found.component.html +++ b/client/src/app/+page-not-found/page-not-found.component.html @@ -1,5 +1,5 @@
-
+
{{ status }}. That's an error. @@ -22,6 +22,21 @@
+
+ {{ status }}. + You are not authorized here. + +
+ You might need to login to see the video. + You might need to login to see the resource. +
+ + + Login + + +
+
{{ status }}. You are not authorized here. diff --git a/client/src/app/core/routing/redirect.service.ts b/client/src/app/core/routing/redirect.service.ts index 2b8cbaa59f72..db4b3501862f 100644 --- a/client/src/app/core/routing/redirect.service.ts +++ b/client/src/app/core/routing/redirect.service.ts @@ -46,6 +46,8 @@ export class RedirectService { this.currentUrl = this.router.url router.events.subscribe(event => { if (event instanceof NavigationEnd || event instanceof NavigationCancel) { + if (event.url === '/404') return + this.previousUrl = this.currentUrl this.currentUrl = event.url diff --git a/client/src/app/shared/shared-main/auth/auth-interceptor.service.ts b/client/src/app/shared/shared-main/auth/auth-interceptor.service.ts index 51248c7b26e5..7daf31a981c1 100644 --- a/client/src/app/shared/shared-main/auth/auth-interceptor.service.ts +++ b/client/src/app/shared/shared-main/auth/auth-interceptor.service.ts @@ -61,8 +61,8 @@ export class AuthInterceptor implements HttpInterceptor { return req.clone({ headers: req.headers.set('Authorization', authHeaderValue) }) } - private handleNotAuthenticated (err: HttpErrorResponse, path = '/login'): Observable { - this.router.navigateByUrl(path) + private handleNotAuthenticated (err: HttpErrorResponse): Observable { + this.router.navigate([ '/404' ], { state: { obj: err }, skipLocationChange: true }) return of(err.message) } }