Include WWW-Authenticate header with 401 response

This commit is contained in:
Bartek Fabiszewski 2017-04-24 14:47:25 +02:00
parent 34095f8edc
commit 5d58abf1e5

View File

@ -45,6 +45,7 @@ if (!$user->isValid && (uConfig::$require_authentication || defined('headless'))
// not authenticated and username not submited
// load form
if (defined('headless')) {
header('WWW-Authenticate: OAuth realm="users@ulogger"');
header('HTTP/1.1 401 Unauthorized', true, 401);
} else {
print
@ -115,6 +116,7 @@ if (!$user->isValid && (uConfig::$require_authentication || defined('headless'))
}
session_destroy();
if (defined('headless')) {
header('WWW-Authenticate: OAuth realm="users@ulogger"');
header('HTTP/1.1 401 Unauthorized', true, 401);
} else {
$url = str_replace("//", "/", $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']) . "/index.php");