mirror of
https://github.com/ansible/awx.git
synced 2026-04-10 12:39:22 -02:30
fixing timer that would log user out on each page refresh
the check to see if the session time existed in memory was not specific enough
This commit is contained in:
@@ -23,14 +23,24 @@
|
|||||||
*/
|
*/
|
||||||
export default
|
export default
|
||||||
['$rootScope', '$cookieStore', 'transitionTo', 'CreateDialog', 'Authorization',
|
['$rootScope', '$cookieStore', 'transitionTo', 'CreateDialog', 'Authorization',
|
||||||
function ($rootScope, $cookieStore, transitionTo, CreateDialog, Authorization) {
|
'Store',
|
||||||
|
function ($rootScope, $cookieStore, transitionTo, CreateDialog, Authorization,
|
||||||
|
Store) {
|
||||||
return {
|
return {
|
||||||
|
|
||||||
sessionTime: null,
|
sessionTime: null,
|
||||||
timeout: null,
|
timeout: null,
|
||||||
|
|
||||||
getSessionTime: function () {
|
getSessionTime: function () {
|
||||||
return (this.sessionTime) ? this.sessionTime : $cookieStore.get('sessionTime');
|
// var sessionTime;
|
||||||
|
// if(this.sessionTime){
|
||||||
|
// return this.sessionTime;
|
||||||
|
// }
|
||||||
|
// else {
|
||||||
|
// sessionTime = Store('sessionTime').time;
|
||||||
|
// return sessionTime;
|
||||||
|
// }
|
||||||
|
return (this.sessionTime) ? this.sessionTime : Store('sessionTime');//$cookieStore.get('sessionTime');
|
||||||
},
|
},
|
||||||
|
|
||||||
isExpired: function () {
|
isExpired: function () {
|
||||||
@@ -76,10 +86,11 @@ export default
|
|||||||
|
|
||||||
moveForward: function () {
|
moveForward: function () {
|
||||||
var tm, t;
|
var tm, t;
|
||||||
tm = ($AnsibleConfig) ? $AnsibleConfig.session_timeout : 1800;
|
tm = ($AnsibleConfig.session_timeout) ? $AnsibleConfig.session_timeout : 1800;
|
||||||
t = new Date().getTime() + (tm * 1000);
|
t = new Date().getTime() + (tm * 1000);
|
||||||
this.sessionTime = t;
|
this.sessionTime = t;
|
||||||
$cookieStore.put('sessionTime', t);
|
// $cookieStore.put('sessionTime', t);
|
||||||
|
Store('sessionTime', t);
|
||||||
$rootScope.sessionExpired = false;
|
$rootScope.sessionExpired = false;
|
||||||
$cookieStore.put('sessionExpired', false);
|
$cookieStore.put('sessionExpired', false);
|
||||||
|
|
||||||
@@ -88,7 +99,7 @@ export default
|
|||||||
|
|
||||||
startTimers: function() {
|
startTimers: function() {
|
||||||
var that = this,
|
var that = this,
|
||||||
tm = ($AnsibleConfig) ? $AnsibleConfig.session_timeout : 1800,
|
tm = ($AnsibleConfig.session_timeout) ? $AnsibleConfig.session_timeout : 1800,
|
||||||
t = tm - 60;
|
t = tm - 60;
|
||||||
|
|
||||||
this.clearTimers();
|
this.clearTimers();
|
||||||
|
|||||||
Reference in New Issue
Block a user