Skip to content

Commit

Permalink
Merge pull request #1875 from pi-hole/tweak/http-only-cookies
Browse files Browse the repository at this point in the history
Add httponly = true to persistent login cookie
  • Loading branch information
DL6ER committed Sep 11, 2021
2 parents cce6889 + cf8602e commit c5cfb29
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions scripts/pi-hole/php/password.php
Expand Up @@ -50,7 +50,8 @@
{
$auth = true;
// Refresh cookie with new expiry
setcookie('persistentlogin', $pwhash, time()+60*60*24*7);
// setcookie( $name, $value, $expire, $path, $domain, $secure, $httponly )
setcookie('persistentlogin', $pwhash, time()+60*60*24*7, null, null, null, true );
}
else
{
Expand Down Expand Up @@ -79,7 +80,8 @@
// Set persistent cookie if selected
if (isset($_POST['persistentlogin']))
{
setcookie('persistentlogin', $pwhash, time()+60*60*24*7);
// setcookie( $name, $value, $expire, $path, $domain, $secure, $httponly )
setcookie('persistentlogin', $pwhash, time()+60*60*24*7, null, null, null, true );
}
header('Location: index.php');
exit();
Expand Down

0 comments on commit c5cfb29

Please sign in to comment.