mirror of
https://github.com/ansible/awx.git
synced 2026-05-19 14:57:39 -02:30
Merge pull request #473 from jaredevantabor/session-fixes
fixing timer issue that would log user out on each page refresh
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