mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-06-30 18:15:11 +00:00
redirect to login page not loggedin users
This commit is contained in:
parent
e5dc17ab2c
commit
3877cd60b2
@ -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) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user