diff options
-rw-r--r-- | etherpad/src/etherpad/sessions.js | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/etherpad/src/etherpad/sessions.js b/etherpad/src/etherpad/sessions.js index c635e41..c218da8 100644 --- a/etherpad/src/etherpad/sessions.js +++ b/etherpad/src/etherpad/sessions.js @@ -52,15 +52,16 @@ function _updateInitialReferrer(data) { } function _getScopedDomain(subDomain) { - var parts = request.domain.split('.'); - parts.pop(); // Remove one level - while (parts.length > 0) { - var domain = parts.join('.'); - if (SUPERDOMAINS[domain]) { - return domain; - } - parts.pop(); // Remove next level - } + var d = request.domain; + if (d.indexOf(".") == -1) { + // special case for "localhost". For some reason, firefox does not like cookie domains + // to be ".localhost". + return undefined; + } + if (subDomain) { + d = subDomain + "." + d; + } + return "." + d; } //-------------------------------------------------------------------------------- |