Skip to content

Commit

Permalink
1777 Remember me for 7 days doesn't work if you log in from Recent Qu…
Browse files Browse the repository at this point in the history
…eries

set cookie if requested

Signed-off-by: Chris Miceli <[email protected]>
  • Loading branch information
chrismiceli committed Sep 16, 2021
1 parent 2d05d8d commit 910f50d
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions scripts/pi-hole/php/password.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,15 @@
// Set hash in new session
$_SESSION["hash"] = $pwhash;

// Set persistent cookie if selected
if (isset($_POST['persistentlogin']))
{
// setcookie( $name, $value, $expire, $path, $domain, $secure, $httponly )
setcookie('persistentlogin', $pwhash, time()+60*60*24*7, null, null, null, true );
}

// Login successful, redirect the user to the homepage to discard the POST request
if ($_SERVER['REQUEST_METHOD'] === 'POST' && $_SERVER['QUERY_STRING'] === 'login') {
// Set persistent cookie if selected
if (isset($_POST['persistentlogin']))
{
// 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 910f50d

Please sign in to comment.