idle session logout issue no : 1597
This commit is contained in:
parent
bc96596709
commit
61081c10cf
@ -53,6 +53,49 @@ app.controller('sessionCtrl', ["$scope", "$localStorage", "$state", 'ipCookie',
|
||||
$scope.checkSuperAdmin = function () {
|
||||
var inlocalDetails = JSON.parse(localStorage.getItem('localObj'));
|
||||
var inlocalDetailss = ipCookie('cookiechk');
|
||||
|
||||
|
||||
|
||||
var idletime = '';
|
||||
|
||||
this.lastActiveTime = new Date();
|
||||
window.onclick = function () {
|
||||
this.lastActiveTime= new Date();
|
||||
};
|
||||
window.onmousemove = function () {
|
||||
this.lastActiveTime= new Date();
|
||||
};
|
||||
window.onkeypress = function () {
|
||||
this.lastActiveTime= new Date();
|
||||
};
|
||||
window.onscroll = function () {
|
||||
this.lastActiveTime= new Date();
|
||||
};
|
||||
|
||||
let idleTimer_k = window.setInterval(CheckIdleTime, 10000);
|
||||
|
||||
function CheckIdleTime() {
|
||||
//returns idle time every 10 seconds
|
||||
let dateNowTime = new Date().getTime();
|
||||
let lastActiveTime = new Date(this.lastActiveTime).getTime();
|
||||
let remTime = Math.floor((dateNowTime-lastActiveTime)/ 1000);
|
||||
idletime = remTime;
|
||||
// converting from milliseconds to seconds
|
||||
// console.log("Idle since "+remTime+" Seconds Last active at "+this.lastActiveTime);
|
||||
if(remTime>'10800')
|
||||
{
|
||||
console.log('inremtime')
|
||||
ipCookie.remove('cookiechk');
|
||||
$window.localStorage.clear();
|
||||
$state.go('login.signin');
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (inlocalDetails != null) {
|
||||
|
||||
if (inlocalDetails.localType == 'R004' && inlocalDetailss.localType == 'R004') {
|
||||
@ -79,7 +122,51 @@ app.controller('sessionCtrl', ["$scope", "$localStorage", "$state", 'ipCookie',
|
||||
// check login user as Admin
|
||||
$scope.checkAdmin = function () {
|
||||
var inlocalDetails = JSON.parse(localStorage.getItem('localObj'));
|
||||
var inlocalDetailss = ipCookie('cookiechk');
|
||||
var inlocalDetailss = ipCookie('cookiechk');
|
||||
|
||||
|
||||
var idletime = '';
|
||||
|
||||
this.lastActiveTime = new Date();
|
||||
window.onclick = function () {
|
||||
this.lastActiveTime= new Date();
|
||||
};
|
||||
window.onmousemove = function () {
|
||||
this.lastActiveTime= new Date();
|
||||
};
|
||||
window.onkeypress = function () {
|
||||
this.lastActiveTime= new Date();
|
||||
};
|
||||
window.onscroll = function () {
|
||||
this.lastActiveTime= new Date();
|
||||
};
|
||||
|
||||
let idleTimer_k = window.setInterval(CheckIdleTime, 10000);
|
||||
|
||||
function CheckIdleTime() {
|
||||
//returns idle time every 10 seconds
|
||||
let dateNowTime = new Date().getTime();
|
||||
let lastActiveTime = new Date(this.lastActiveTime).getTime();
|
||||
let remTime = Math.floor((dateNowTime-lastActiveTime)/ 1000);
|
||||
idletime = remTime;
|
||||
// converting from milliseconds to seconds
|
||||
//console.log("Idle since "+remTime+" Seconds Last active at "+this.lastActiveTime);
|
||||
if(remTime>'10800')
|
||||
{
|
||||
console.log('inremtime')
|
||||
ipCookie.remove('cookiechk');
|
||||
$window.localStorage.clear();
|
||||
$state.go('login.signin');
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (inlocalDetails != null) {
|
||||
|
||||
if (inlocalDetails.localType == 'R003' && inlocalDetailss.localType == 'R003') {
|
||||
@ -107,9 +194,52 @@ app.controller('sessionCtrl', ["$scope", "$localStorage", "$state", 'ipCookie',
|
||||
|
||||
// check login user as Staff
|
||||
$scope.checkStaff = function () {
|
||||
var inlocalDetails = JSON.parse(localStorage.getItem('localObj'));
|
||||
var inlocalDetails = JSON.parse(localStorage.getItem('localObj'));
|
||||
var inlocalDetailss = ipCookie('cookiechk');
|
||||
|
||||
|
||||
var idletime = '';
|
||||
|
||||
this.lastActiveTime = new Date();
|
||||
window.onclick = function () {
|
||||
this.lastActiveTime= new Date();
|
||||
};
|
||||
window.onmousemove = function () {
|
||||
this.lastActiveTime= new Date();
|
||||
};
|
||||
window.onkeypress = function () {
|
||||
this.lastActiveTime= new Date();
|
||||
};
|
||||
window.onscroll = function () {
|
||||
this.lastActiveTime= new Date();
|
||||
};
|
||||
|
||||
let idleTimer_k = window.setInterval(CheckIdleTime, 10000);
|
||||
|
||||
function CheckIdleTime() {
|
||||
//returns idle time every 10 seconds
|
||||
let dateNowTime = new Date().getTime();
|
||||
let lastActiveTime = new Date(this.lastActiveTime).getTime();
|
||||
let remTime = Math.floor((dateNowTime-lastActiveTime)/ 1000);
|
||||
idletime = remTime;
|
||||
// converting from milliseconds to seconds
|
||||
//console.log("Idle since "+remTime+" Seconds Last active at "+this.lastActiveTime);
|
||||
if(remTime>'10800')
|
||||
{
|
||||
console.log('inremtime')
|
||||
ipCookie.remove('cookiechk');
|
||||
$window.localStorage.clear();
|
||||
$state.go('login.signin');
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (inlocalDetails != null) {
|
||||
|
||||
if ((inlocalDetails.localType == 'R002' && inlocalDetailss.localType == 'R002') || (inlocalDetails.localType == 'R005' && inlocalDetailss.localType == 'R005')) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user