mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 21:35:50 +00:00
redirect user to login when session expired
This commit is contained in:
@@ -12,7 +12,8 @@ import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { BackgroundService } from 'src/app/services/background.service';
|
||||
import { ScreenOrientation } from '@ionic-native/screen-orientation/ngx';
|
||||
import { StorageService } from 'src/app/services/storage.service';
|
||||
import { MessageModel } from './models/beast-orm'
|
||||
import { MessageModel } from './models/beast-orm';
|
||||
import { InativityService } from "src/app/services/inativity.service";
|
||||
|
||||
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
|
||||
parse: {
|
||||
@@ -43,7 +44,8 @@ export class AppComponent {
|
||||
private screenOrientation: ScreenOrientation,
|
||||
private sqliteservice: SqliteService,
|
||||
private backgroundservice: BackgroundService,
|
||||
private storageservice: StorageService
|
||||
private storageservice: StorageService,
|
||||
private InativityService: InativityService
|
||||
) {
|
||||
// this.createCacheFolder()
|
||||
this.initializeApp();
|
||||
|
||||
@@ -118,7 +118,12 @@ export class HomePage implements OnInit {
|
||||
|
||||
const pathname = window.location.pathname
|
||||
SessionStore.setUrlBeforeInactivity(pathname)
|
||||
this.router.navigate(['/inactivity']);
|
||||
|
||||
if (this.platform.is('mobileweb')) {
|
||||
this.router.navigate(['/inactivity']);
|
||||
}else{
|
||||
this.router.navigate(['/']);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ export class InativityService {
|
||||
private router: Router,
|
||||
) {
|
||||
|
||||
var t;
|
||||
var time;
|
||||
window.onload = resetTimer;
|
||||
window.onmousemove = resetTimer;
|
||||
window.onmousedown = resetTimer; // catches touchscreen presses as well
|
||||
@@ -28,8 +28,9 @@ export class InativityService {
|
||||
}
|
||||
|
||||
function resetTimer() {
|
||||
clearTimeout(t);
|
||||
t = setTimeout(userIsNotActive, 60000 * 5); // time is in milliseconds
|
||||
clearTimeout(time);
|
||||
// t = setTimeout(userIsNotActive, 60000 * 5); // time is in milliseconds
|
||||
time = setTimeout(userIsNotActive, 3000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user