mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-21 05:45:50 +00:00
save
This commit is contained in:
@@ -22,14 +22,15 @@ export class AuthGuard implements CanActivate {
|
||||
route: ActivatedRouteSnapshot,
|
||||
state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
|
||||
|
||||
// if user not active
|
||||
if(!SessionStore.user.Inactivity) {
|
||||
this.router.navigate(['/']);
|
||||
return false
|
||||
}
|
||||
// if session doesn't exit
|
||||
else if(!SessionStore.exist) {
|
||||
this.router.navigate(['/']);
|
||||
// if user not active or no session
|
||||
if(!SessionStore.user.Inactivity || !SessionStore.exist) {
|
||||
|
||||
if(SessionStore.user.LoginPreference == 'Pin') {
|
||||
this.router.navigate(['/pin']);
|
||||
} else {
|
||||
this.router.navigate(['/']);
|
||||
}
|
||||
|
||||
return false
|
||||
} else {
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ export class InactivityGuard implements CanActivate {
|
||||
|
||||
console.log('hire inactinity!', state.url)
|
||||
|
||||
if ((this.platform.is('desktop') || this.platform.is('mobileweb')) && (SessionStore?.user?.Inactivity) ) {
|
||||
if ( (this.platform.is('desktop') || this.platform.is('mobileweb')) ) {
|
||||
if(this.p.userPermission(this.p.permissionList.Agenda.access) || this.p.userPermission(this.p.permissionList.Gabinete.access)){
|
||||
this.router.navigate(['/home/events']);
|
||||
}
|
||||
@@ -56,7 +56,10 @@ export class InactivityGuard implements CanActivate {
|
||||
} else if(SessionStore.exist && !SessionStore.user.Inactivity && SessionStore.user.LoginPreference == 'Pin') {
|
||||
// inactivity login
|
||||
return true
|
||||
} else if (SessionStore.user.LoginPreference != 'Pin' && !SessionStore.user.Inactivity) {
|
||||
} else if (!SessionStore.user.Inactivity && this.platform.is('mobile')) {
|
||||
// try to login
|
||||
return true
|
||||
} else if (SessionStore.user.LoginPreference != 'Pin' && SessionStore.hasPin) {
|
||||
// no right to be in this page
|
||||
|
||||
this.router.navigateByUrl('/', { replaceUrl: true });
|
||||
|
||||
@@ -28,7 +28,7 @@ export class LoginGuard implements CanActivate {
|
||||
// login with password while has pin
|
||||
SessionStore.forceToLoginWithForceToLogInWithPassword = false
|
||||
return true
|
||||
} else if(SessionStore.exist && !this.platform.is('desktop') && !this.platform.is('mobileweb') ) {
|
||||
} else if(SessionStore.exist && this.platform.is('mobile') && SessionStore.user.LoginPreference == 'Pin' ) {
|
||||
// go to pin page
|
||||
this.router.navigate(['/pin']);
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user