mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 07:56:16 -04:00
Add secure flag to cookies on client side if pad accessed through https
This commit is contained in:
parent
93dae51cda
commit
06ff023047
2 changed files with 11 additions and 3 deletions
|
@ -43,7 +43,8 @@ var padcookie = (function()
|
|||
{
|
||||
var expiresDate = new Date();
|
||||
expiresDate.setFullYear(3000);
|
||||
document.cookie = ('prefs=' + safeText + ';expires=' + expiresDate.toGMTString());
|
||||
var secure = isHttpsScheme() ? ";secure" : "";
|
||||
document.cookie = ('prefs=' + safeText + ';expires=' + expiresDate.toGMTString() + secure);
|
||||
}
|
||||
|
||||
function parseCookie(text)
|
||||
|
@ -79,6 +80,10 @@ var padcookie = (function()
|
|||
alreadyWarnedAboutNoCookies = true;
|
||||
}
|
||||
}
|
||||
|
||||
function isHttpsScheme() {
|
||||
return window.location.protocol == "https:";
|
||||
}
|
||||
|
||||
var wasNoCookie = true;
|
||||
var cookieData = {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue