mirror of
https://github.com/standardebooks/web.git
synced 2025-07-06 23:00:28 -04:00
Log user in automatically if a request with HTTP auth is received
This commit is contained in:
parent
216e63f014
commit
c457af896c
6 changed files with 25 additions and 10 deletions
12
lib/Core.php
12
lib/Core.php
|
@ -28,3 +28,15 @@ if(SITE_STATUS == SITE_STATUS_LIVE){
|
|||
}
|
||||
|
||||
$GLOBALS['User'] = Session::GetLoggedInUser();
|
||||
|
||||
if($GLOBALS['User'] === null){
|
||||
$httpBasicAuthLogin = $_SERVER['PHP_AUTH_USER'] ?? null;
|
||||
|
||||
if($httpBasicAuthLogin !== null){
|
||||
// If there's no logged in user, but a username was sent via HTTP basic auth,
|
||||
// log them in while we're here.
|
||||
|
||||
$session = new Session();
|
||||
$session->Create($httpBasicAuthLogin);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue