mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-02-01 11:22:41 +01:00
Use different cookie name for different protocols - https://github.com/ether/etherpad-lite/issues/3179
This commit is contained in:
parent
b43137ad2c
commit
96cc1ad55a
1 changed files with 4 additions and 2 deletions
|
@ -23,6 +23,8 @@
|
||||||
|
|
||||||
var padcookie = (function()
|
var padcookie = (function()
|
||||||
{
|
{
|
||||||
|
var cookieName = isHttpsScheme() ? "prefs" : "prefsHttp";
|
||||||
|
|
||||||
function getRawCookie()
|
function getRawCookie()
|
||||||
{
|
{
|
||||||
// returns null if can't get cookie text
|
// returns null if can't get cookie text
|
||||||
|
@ -31,7 +33,7 @@ var padcookie = (function()
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// look for (start of string OR semicolon) followed by whitespace followed by prefs=(something);
|
// 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]))
|
if ((!regexResult) || (!regexResult[1]))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
|
@ -44,7 +46,7 @@ var padcookie = (function()
|
||||||
var expiresDate = new Date();
|
var expiresDate = new Date();
|
||||||
expiresDate.setFullYear(3000);
|
expiresDate.setFullYear(3000);
|
||||||
var secure = isHttpsScheme() ? ";secure" : "";
|
var secure = isHttpsScheme() ? ";secure" : "";
|
||||||
document.cookie = ('prefs=' + safeText + ';expires=' + expiresDate.toGMTString() + secure);
|
document.cookie = (cookieName + "=" + safeText + ";expires=" + expiresDate.toGMTString() + secure);
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseCookie(text)
|
function parseCookie(text)
|
||||||
|
|
Loading…
Reference in a new issue