X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FSecurity%2FBasicAuth.php;h=fc31d34b0717507f3dce391bef656b2785ed8b0a;hb=0b50dc363bc5db93f96c22fc6a5546b17d0bdb79;hp=f2154ae8a4374da15fa121719a0f7af660eb442d;hpb=536fbe5af17a4a393ea440155e2770f63b5a71f5;p=friendica.git diff --git a/src/Security/BasicAuth.php b/src/Security/BasicAuth.php index f2154ae8a4..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); - if (Session::get('allow_api')) { - self::$current_user_id = local_user(); - } else { - self::$current_user_id = 0; - } + self::$current_user_id = local_user(); + return self::$current_user_id; } }