Merge pull request #976 from Alfresco/dev-mromano-975

redirect to login page not loggedin users
This commit is contained in:
Eugenio Romano
2016-11-02 10:52:50 +00:00
committed by GitHub
+8 -1
View File
@@ -51,11 +51,18 @@ export class AppComponent {
} }
isLoggedIn(): boolean { isLoggedIn(): boolean {
this.redirectToLoginPageIfNotLoggedIn();
return this.auth.isLoggedIn(); return this.auth.isLoggedIn();
} }
redirectToLoginPageIfNotLoggedIn(): void {
if (!this.isLoginPage() && !this.auth.isLoggedIn()) {
this.router.navigate(['/login']);
}
}
isLoginPage(): boolean { isLoginPage(): boolean {
return location.pathname === '/login' || location.pathname === '/'; return location.pathname === '/login' || location.pathname === '/' || location.pathname === '/settings';
} }
onLogout(event) { onLogout(event) {