X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FSecurity%2FBasicAuth.php;h=fc31d34b0717507f3dce391bef656b2785ed8b0a;hb=e56a53647bd5469551bf4f9ef2df50a5dd16b943;hp=b76073e8b328f1dbccf2388d6e16fe8e01958551;hpb=8bf5dd187b5892e0724b66ab75c6896c55b21f99;p=friendica.git diff --git a/src/Security/BasicAuth.php b/src/Security/BasicAuth.php index b76073e8b3..fc31d34b07 100644 --- a/src/Security/BasicAuth.php +++ b/src/Security/BasicAuth.php @@ -1,6 +1,6 @@ $_SERVER]); - header('WWW-Authenticate: Basic realm="Friendica"'); + // Checking for commandline for the tests, we have to avoid to send a header + if (php_sapi_name() !== 'cli') { + header('WWW-Authenticate: Basic realm="Friendica"'); + } throw new UnauthorizedException("This API requires login"); } @@ -182,15 +189,10 @@ class BasicAuth DI::auth()->setForUser($a, $record, false, false, $login_refresh); - Session::set('allow_api', true); + Hook::callAll('logged_in', $record); - Hook::callAll('logged_in', $a->user); + self::$current_user_id = local_user(); - if (Session::get('allow_api')) { - self::$current_user_id = local_user(); - } else { - self::$current_user_id = 0; - } return self::$current_user_id; } }