Node.js based forum software built for the modern web
Code review change
Dominic Lennona06e39528f4c
diff --git a/src/database/mongo.js b/src/database/mongo.jsindex 9e1c3a5a8f..b91acde0cb 100644--- a/src/database/mongo.js+++ b/src/database/mongo.js@@ -9,7 +9,6 @@var session = require('express-session');var _ = require('underscore');var semver = require('semver');- var meta = require('../meta');var db;_.mixin(require('underscore.deep'));@@ -130,14 +129,12 @@rdb.client = rdb.connect();var ttlDays = 1000 * 60 * 60 * 24 * (parseInt(meta.config.loginDays, 10) || 0);- var ttlHours = 1000 * 60 * 60 * (parseInt(meta.config.loginHours, 10) || 0);- var ttlMinutes = 1000 * 60 * (parseInt(meta.config.loginMinutes, 10) || 0);var ttlSeconds = 1000 * (parseInt(meta.config.loginSeconds, 10) || 0);- var ttlTotal = (ttlDays + ttlHours + ttlMinutes + ttlSeconds) || 1209600000; // Default to 14 days+ var ttl = ttlSeconds || ttlDays || 1209600000; // Default to 14 daysmodule.sessionStore = new sessionStore({client: rdb.client,- ttl: ttlTotal+ ttl: ttl});} else if (nconf.get('mongo')) {sessionStore = require('connect-mongo')(session);diff --git a/src/database/redis.js b/src/database/redis.jsindex 7d89054b26..8519b57bae 100644--- a/src/database/redis.js+++ b/src/database/redis.js@@ -63,14 +63,12 @@var sessionStore = require('connect-redis')(session);var ttlDays = 1000 * 60 * 60 * 24 * (parseInt(meta.config.loginDays, 10) || 0);- var ttlHours = 1000 * 60 * 60 * (parseInt(meta.config.loginHours, 10) || 0);- var ttlMinutes = 1000 * 60 * (parseInt(meta.config.loginMinutes, 10) || 0);var ttlSeconds = 1000 * (parseInt(meta.config.loginSeconds, 10) || 0);- var ttlTotal = (ttlDays + ttlHours + ttlMinutes + ttlSeconds) || 1209600000; // Default to 14 days+ var ttl = ttlSeconds || ttlDays || 1209600000; // Default to 14 daysmodule.sessionStore = new sessionStore({client: module.client,- ttl: ttlTotal+ ttl: ttl});if (typeof callback === 'function') {diff --git a/src/views/admin/settings/user.tpl b/src/views/admin/settings/user.tplindex 440b34edbb..25de94b6d4 100644--- a/src/views/admin/settings/user.tpl+++ b/src/views/admin/settings/user.tpl@@ -113,19 +113,18 @@</div><div class="row">- <div class="col-sm-2 col-xs-12 settings-header">Session time+ <div class="col-sm-2 col-xs-12 settings-header">+ Session time</div><div class="col-sm-10 col-xs-12"><form><div class="form-group"><label>Days: </label><input type="text" class="form-control" data-field="loginDays" placeholder="Days" />- <label>Hours: </label>- <input type="text" class="form-control" data-field="loginHours" placeholder="Hours" />- <label>Minutes: </label>- <input type="text" class="form-control" data-field="loginMinutes" placeholder="Minutes" /><label>Seconds: </label><input type="text" class="form-control" data-field="loginSeconds" placeholder="Seconds" />+ <p class="help-block">Note that only one of these values will be used. If there is no <i>seconds</i> value we fall back to <i>days</i>. If+ there is no <i>days</i> value we default to <i>14 days</i>.</div></form></div>diff --git a/src/webserver.js b/src/webserver.jsindex 686451aef7..4e103d4a11 100644--- a/src/webserver.js+++ b/src/webserver.js@@ -171,13 +171,11 @@ function setupFavicon(app) {function setupCookie() {var ttlDays = 1000 * 60 * 60 * 24 * (parseInt(meta.config.loginDays, 10) || 0);- var ttlHours = 1000 * 60 * 60 * (parseInt(meta.config.loginHours, 10) || 0);- var ttlMinutes = 1000 * 60 * (parseInt(meta.config.loginMinutes, 10) || 0);var ttlSeconds = 1000 * (parseInt(meta.config.loginSeconds, 10) || 0);- var ttlTotal = (ttlDays + ttlHours + ttlMinutes + ttlSeconds) || 1209600000; // Default to 14 days+ var ttl = ttlSeconds || ttlDays || 1209600000; // Default to 14 daysvar cookie = {- maxAge: ttlTotal+ maxAge: ttl};if (nconf.get('cookieDomain') || meta.config.cookieDomain) {