Skip to content

Commit

Permalink
Ignore "session_lifetime" if it can not be converted to a number
Browse files Browse the repository at this point in the history
When "session_lifetime" can not be converted to a number the interval
becomes a NaN due to dividing it by 2. This NaN was "dragged" over all
the other mathematical operations and caused the csrftoken to be got
again and again due to an infinite loop with no pauses in "setInterval".
Now, the interval is set to the default value instead if the
"session_lifetime" can not be converted to a number.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
  • Loading branch information
danxuliu committed Oct 11, 2018
1 parent 55e737a commit a246cc1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/js/js.js
Original file line number Diff line number Diff line change
Expand Up @@ -1402,10 +1402,12 @@ function initCore() {
*/
function initSessionHeartBeat() {
// interval in seconds
var interval = 900;
var interval = NaN;
if (oc_config.session_lifetime) {
interval = Math.floor(oc_config.session_lifetime / 2);
}
interval = isNaN(interval)? 900: interval;

// minimum one minute
interval = Math.max(60, interval);
// max interval in seconds set to 24 hours
Expand Down

0 comments on commit a246cc1

Please sign in to comment.