This commit is contained in:
Peter Maquiran
2022-12-21 14:53:01 +01:00
parent 978f2dff4b
commit 0c80a6d84d
2 changed files with 30 additions and 24 deletions
+26 -22
View File
@@ -23,7 +23,7 @@ export class InactivityGuard implements CanActivate {
console.log('hire inactinity!', state.url)
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
if ((this.platform.is('desktop') || this.platform.is('mobileweb')) && (SessionStore?.user?.Inactivity) ) {
if(this.p.userPermission(this.p.permissionList.Agenda.access) || this.p.userPermission(this.p.permissionList.Gabinete.access)){
this.router.navigate(['/home/events']);
}
@@ -64,29 +64,33 @@ export class InactivityGuard implements CanActivate {
}//Mobile or Tablet without session
else {
if(this.p.userPermission(this.p.permissionList.Agenda.access) || this.p.userPermission(this.p.permissionList.Gabinete.access)){
this.router.navigate(['/home/events']);
if((SessionStore?.user?.Inactivity)) {
if(this.p.userPermission(this.p.permissionList.Agenda.access) || this.p.userPermission(this.p.permissionList.Gabinete.access)){
this.router.navigate(['/home/events']);
}
else if(this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)){
this.router.navigate(['/home/chat']);
}
else if(this.p.userPermission(this.p.permissionList.Actions.access)){
this.router.navigate(['/home/publications']);
} else {
this.alertController.create({
cssClass: 'my-custom-class',
header: 'Utilizador sem acesso a aplicação',
buttons: [{
text: 'Ok',
handler: () => {
}
}]
}).then( async (alertPopup)=>{
await alertPopup.present();
})
}
return false
}
else if(this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)){
this.router.navigate(['/home/chat']);
}
else if(this.p.userPermission(this.p.permissionList.Actions.access)){
this.router.navigate(['/home/publications']);
} else {
this.alertController.create({
cssClass: 'my-custom-class',
header: 'Utilizador sem acesso a aplicação',
buttons: [{
text: 'Ok',
handler: () => {
}
}]
}).then( async (alertPopup)=>{
await alertPopup.present();
})
}
return false
}
}
+4 -2
View File
@@ -21,18 +21,20 @@ export class LoginGuard implements CanActivate {
if(SessionStore.exist && SessionStore.user.Inactivity && SessionStore.user.LoginPreference != 'Pin' ) {
// enter app
this.router.navigate(['/home/events']);
return false
} else if(SessionStore.exist && !SessionStore.user.Inactivity && SessionStore.user.LoginPreference == 'Pin' && SessionStore.forceToLoginWithForceToLogInWithPassword && !this.platform.is('desktop') && !this.platform.is('mobileweb')) {
// login with password while has pin
SessionStore.forceToLoginWithForceToLogInWithPassword = false
return true
} else if(SessionStore.exist && SessionStore.user.Inactivity && !SessionStore.hasPin && !this.platform.is('desktop') && !this.platform.is('mobileweb') ) {
} else if(SessionStore.exist && !this.platform.is('desktop') && !this.platform.is('mobileweb') ) {
// go to pin page
this.router.navigate(['/pin']);
return false
} else if(SessionStore.exist && !SessionStore.user.Inactivity && SessionStore.user.LoginPreference == 'Pin' && !this.platform.is('desktop') && !this.platform.is('mobileweb')) {
this.router.navigate(['/inactivity']);
return false
} else {
return true
}