diff --git a/src/app/authentication.guard.ts b/src/app/authentication.guard.ts index c4cf7fe48b391d136528d19c0e46ba80842c0154..603935c9260f39e6966742a718c6636d4da76296 100644 --- a/src/app/authentication.guard.ts +++ b/src/app/authentication.guard.ts @@ -5,10 +5,12 @@ import { AuthenticationService } from './authentication.service'; import 'rxjs/add/operator/map'; import 'rxjs/add/observable/of'; import 'rxjs/add/operator/catch'; +import { NotificationService } from './notification.service'; @Injectable() export class AuthenticationGuard implements CanActivate { constructor(private authenticationService: AuthenticationService, + private notificationService: NotificationService, private router: Router) { } @@ -16,6 +18,7 @@ export class AuthenticationGuard implements CanActivate { state: RouterStateSnapshot): Observable<boolean> { return this.authenticationService.isLoggedIn().map(isLoggedIn => { if (!isLoggedIn) { + this.notificationService.show(`You're not authorized to view this page.`); // TODO: redirect to error page this.router.navigate(['/']); }