My first comment is that I see this session message every time
I open the login window (access wokd URL). I think it has something
to do with the brief opening of the User Log view for like 1 second
before showing the login window. It is easily reproducible: just open
wok URL without logging in. You'll see the User Log + this session
message flashing for a moment every time.
I am saying this because you patch is trying to fix the issue
when logging in and, perhaps, we can look at this scenario
pre-login as well (don't need to be in this same patch).
More comments below.
On 08/02/2016 05:22 PM, peterpnns(a)gmail.com wrote:
From: peterpennings <peterpnns(a)gmail.com>
Signed-off-by: peterpennings <peterpnns(a)gmail.com>
---
ui/js/src/wok.api.js | 3 +++
1 file changed, 3 insertions(+)
diff --git a/ui/js/src/wok.api.js b/ui/js/src/wok.api.js
index e2829ab..2c3206c 100644
--- a/ui/js/src/wok.api.js
+++ b/ui/js/src/wok.api.js
@@ -43,6 +43,9 @@ var wok = {
settings['wok'] = true;
settings['complete'] = function(req) {
wok.session.remainingSessionTime =
req.getResponseHeader('Session-Expires-On');
+ if (wok.session.remainingSessionTime == null) {
+ wok.session.remainingSessionTime = 30;
+ }
I don't like how we are hardcoding the '30'. These are the instances
I've found of this timer (with your patch applied):
[danielhb@arthas src]$ grep -R '30' .
./wok.session.js: remaingTimeToShowAlert: 30000,
./wok.session.js: $("#session-expiring-alert
p").html("<script>var message =
i18n['WOKSESS0001M'].replace('%1', 30);"
./wok.session.js: + "var n = 30;"
./wok.api.js: wok.session.remainingSessionTime = 30;
[danielhb@arthas src]$
We need to put this 30 in a variable to be accessible by all these
instances. Otherwise any change of this timer will require searching
for every hardcoded instance of it.
Daniel
wok.session.remainingSessionTime =
(parseInt(wok.session.remainingSessionTime, 10) * 1000);
if (!wok.session.flagInTimer) {
wok.session.refreshExpiringCounter();