X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FSecurity%2FBasicAuth.php;h=fc31d34b0717507f3dce391bef656b2785ed8b0a;hb=0b50dc363bc5db93f96c22fc6a5546b17d0bdb79;hp=2b4baaa36ed65f9be86c5ac46b80caaea9e145d4;hpb=abbe7895ae48570a9fc87b4ed85fd8a75c1c83f5;p=friendica.git diff --git a/src/Security/BasicAuth.php b/src/Security/BasicAuth.php index 2b4baaa36e..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"); } @@ -187,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; } }