summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMikk Andresen <mikk.andresen@gmail.com>2017-05-05 10:28:44 +0300
committerMikk Andresen <mikk.andresen@gmail.com>2017-05-05 10:28:44 +0300
commit96cc1ad55acd077f7e3ecc18685b7cee0cb58e18 (patch)
tree7800cc671918bc566161c725ee50a0b377cc646d /src
parentb43137ad2c30b8d8153a7f66ecb493ca3822481f (diff)
downloadetherpad-lite-96cc1ad55acd077f7e3ecc18685b7cee0cb58e18.zip
Use different cookie name for different protocols - https://github.com/ether/etherpad-lite/issues/3179
Diffstat (limited to 'src')
-rw-r--r--src/static/js/pad_cookie.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/static/js/pad_cookie.js b/src/static/js/pad_cookie.js
index b563a7e6..72eb3fe9 100644
--- a/src/static/js/pad_cookie.js
+++ b/src/static/js/pad_cookie.js
@@ -23,6 +23,8 @@
var padcookie = (function()
{
+ var cookieName = isHttpsScheme() ? "prefs" : "prefsHttp";
+
function getRawCookie()
{
// returns null if can't get cookie text
@@ -31,7 +33,7 @@ var padcookie = (function()
return null;
}
// look for (start of string OR semicolon) followed by whitespace followed by prefs=(something);
- var regexResult = document.cookie.match(/(?:^|;)\s*prefs=([^;]*)(?:;|$)/);
+ var regexResult = document.cookie.match(new RegExp("(?:^|;)\s*" + cookieName + "=([^;]*)(?:;|$)"));
if ((!regexResult) || (!regexResult[1]))
{
return null;
@@ -44,7 +46,7 @@ var padcookie = (function()
var expiresDate = new Date();
expiresDate.setFullYear(3000);
var secure = isHttpsScheme() ? ";secure" : "";
- document.cookie = ('prefs=' + safeText + ';expires=' + expiresDate.toGMTString() + secure);
+ document.cookie = (cookieName + "=" + safeText + ";expires=" + expiresDate.toGMTString() + secure);
}
function parseCookie(text)