aboutsummaryrefslogtreecommitdiff
path: root/js/lib
diff options
context:
space:
mode:
authorSteve Clay <steve@mrclay.org>2013-06-08 23:29:52 -0400
committerSteve Clay <steve@mrclay.org>2013-06-08 23:29:52 -0400
commit42726251455e87b5ee4d368c0e743057506ad60d (patch)
tree80d56a4be5335afdc1a6d89fed4754ced01be216 /js/lib
parent2b4002aca8c19c24a9ffca7bfdd71535a4ebba88 (diff)
downloadelgg-42726251455e87b5ee4d368c0e743057506ad60d.tar.gz
elgg-42726251455e87b5ee4d368c0e743057506ad60d.tar.bz2
Fixes elgg.session.cookie() support of Date() for expires
Diffstat (limited to 'js/lib')
-rw-r--r--js/lib/session.js27
1 files changed, 12 insertions, 15 deletions
diff --git a/js/lib/session.js b/js/lib/session.js
index fa3d60aa9..0fc7f5c87 100644
--- a/js/lib/session.js
+++ b/js/lib/session.js
@@ -47,21 +47,18 @@ elgg.session.cookie = function (name, value, options) {
}
cookies.push(name + '=' + value);
-
- if (elgg.isNumber(options.expires)) {
- if (elgg.isNumber(options.expires)) {
- date = new Date();
- date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
- } else if (options.expires.toUTCString) {
- date = options.expires;
- } else {
- valid = false;
- }
-
- if (valid) {
- cookies.push('expires=' + date.toUTCString());
- }
- }
+
+ if (elgg.isNumber(options.expires)) {
+ date = new Date();
+ date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
+ } else if (options.expires.toUTCString) {
+ date = options.expires;
+ }
+
+ if (date) {
+ cookies.push('expires=' + date.toUTCString());
+ }
+
// CAUTION: Needed to parenthesize options.path and options.domain
// in the following expressions, otherwise they evaluate to undefined