diff --git a/src/app/guards/auth.guard.ts b/src/app/guards/auth.guard.ts index f6ed7fa9b..17b45ac9f 100644 --- a/src/app/guards/auth.guard.ts +++ b/src/app/guards/auth.guard.ts @@ -29,8 +29,8 @@ export class AuthGuard implements CanActivate { this.router.navigate(['/']); return false } else { - this.authService.loginChat(SessionStore.user) - return true + this.authService.loginChat(); + return true; } } diff --git a/src/app/pages/inactivity/inactivity.page.ts b/src/app/pages/inactivity/inactivity.page.ts index 7b52d83da..4a60452d7 100644 --- a/src/app/pages/inactivity/inactivity.page.ts +++ b/src/app/pages/inactivity/inactivity.page.ts @@ -36,11 +36,11 @@ export class InactivityPage implements OnInit { loop = false ngOnInit() { - + // window.addEventListener('resize', (event) => { // if(this.router.url != '/login') return false - + // if(this.loop == false) { // this.loop = true // this.runloop() @@ -54,7 +54,7 @@ export class InactivityPage implements OnInit { // const containerHeight = 651 // let circleHeight = document.querySelector('.circle')['offsetHeight'] - // let circleWidth = document.querySelector('.circle')['offsetWidth'] + // let circleWidth = document.querySelector('.circle')['offsetWidth'] // console.log(window.innerHeight, ' < ', containerHeight) // console.log(circleHeight) @@ -64,7 +64,7 @@ export class InactivityPage implements OnInit { // e['style']['width'] = (circleWidth -1 )+'px' // }) - + // if( window.innerHeight< containerHeight) { // setTimeout(()=>{ // this.runloop() @@ -114,14 +114,14 @@ export class InactivityPage implements OnInit { let attempt = await this.authService.login(this.userattempt, {saveSession: false}) if (attempt) { - + // if current attemp is equal to the current user if (attempt.UserId == SessionStore.user.UserId) { await this.authService.SetSession(attempt, this.userattempt); - this.authService.loginChat(this.userattempt); + this.authService.loginChat(); this.getToken(); SessionStore.setInativity(true) - + this.goback() } else { SessionStore.delete() @@ -174,10 +174,10 @@ export class InactivityPage implements OnInit { const code = this.code.join('') if( SessionStore.validatePin(code)) { - + SessionStore.setInativity(true) this.goback() - + setTimeout(()=>{ this.clearCode() }, 1000) @@ -196,7 +196,7 @@ export class InactivityPage implements OnInit { } else { this.router.navigate(['/home/events'], {replaceUrl: true}); } - + } storePin() { diff --git a/src/app/pages/login/login.page.ts b/src/app/pages/login/login.page.ts index 46be42992..de8e9d8f8 100644 --- a/src/app/pages/login/login.page.ts +++ b/src/app/pages/login/login.page.ts @@ -102,7 +102,7 @@ export class LoginPage implements OnInit { if (attempt) { if (attempt.UserId == SessionStore.user.UserId) { await this.authService.SetSession(attempt, this.userattempt); - await this.authService.loginChat(this.userattempt); + await this.authService.loginChat(); this.getToken(); SessionStore.setInativity(true); @@ -116,7 +116,7 @@ export class LoginPage implements OnInit { await this.authService.SetSession(attempt, this.userattempt); this.changeProfileService.run() - await this.authService.loginChat(this.userattempt); + await this.authService.loginChat(); this.getToken(); this.router.navigateByUrl('/pin', { replaceUrl: true }); } diff --git a/src/app/services/auth.service.ts b/src/app/services/auth.service.ts index fbf7b762b..5698453cd 100644 --- a/src/app/services/auth.service.ts +++ b/src/app/services/auth.service.ts @@ -109,7 +109,7 @@ export class AuthService { //Login to rocketChat server2 //user: UserForm - async loginChat(user: any) { + async loginChat() { const expirationMinutes = 60; let date = new Date().getTime(); @@ -136,12 +136,12 @@ export class AuthService { this.presentAlert('Network error'); } - this.autoLoginChat(expirationDate.getTime() - date, user); + this.autoLoginChat(expirationDate.getTime() - date); } - async autoLoginChat(expirationDate:number, user:any){ + async autoLoginChat(expirationDate:number){ setTimeout(()=>{ - this.loginChat(user); + this.loginChat(); }, expirationDate) }