mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-21 13:55:51 +00:00
Improve login
This commit is contained in:
@@ -8,19 +8,23 @@ import { SessionStore } from '../store/session.service';
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class LoginGuard implements CanActivate {
|
||||
constructor( private router:Router,
|
||||
private localstoreService: LocalstoreService) {
|
||||
constructor( private router:Router) {
|
||||
|
||||
}
|
||||
canActivate(
|
||||
route: ActivatedRouteSnapshot,
|
||||
state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
|
||||
|
||||
if(window.location.pathname == '/' && SessionStore.exist ) {
|
||||
if(SessionStore.exist && SessionStore.user.Inactivity && SessionStore.user.LoginPreference != 'Pin' ) {
|
||||
this.router.navigate(['/home/events']);
|
||||
return false
|
||||
} else if(SessionStore.exist && !SessionStore.hasPin ) {
|
||||
this.router.navigate(['/pin']);
|
||||
return false
|
||||
} else if(SessionStore.exist && !SessionStore.user.Inactivity && SessionStore.user.LoginPreference == 'Pin' ) {
|
||||
this.router.navigate(['/inactivity']);
|
||||
return false
|
||||
} else {
|
||||
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user