mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-20 15:36: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
|
@ -53,13 +53,16 @@ function createCookie(name, value, days, path){ /* Used by IE */
|
|||
if(!path){ // IF the Path of the cookie isn't set then just create it on root
|
||||
path = "/";
|
||||
}
|
||||
|
||||
//Check if we accessed the pad over https
|
||||
var secure = window.location.protocol == "https:" ? ";secure" : "";
|
||||
|
||||
//Check if the browser is IE and if so make sure the full path is set in the cookie
|
||||
if((navigator.appName == 'Microsoft Internet Explorer') || ((navigator.appName == 'Netscape') && (new RegExp("Trident/.*rv:([0-9]{1,}[\.0-9]{0,})").exec(navigator.userAgent) != null))){
|
||||
document.cookie = name + "=" + value + expires + "; path=/"; /* Note this bodge fix for IE is temporary until auth is rewritten */
|
||||
document.cookie = name + "=" + value + expires + "; path=/" + secure; /* Note this bodge fix for IE is temporary until auth is rewritten */
|
||||
}
|
||||
else{
|
||||
document.cookie = name + "=" + value + expires + "; path=" + path;
|
||||
document.cookie = name + "=" + value + expires + "; path=" + path + secure;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue