Support for cleared boot.php

This commit is contained in:
Michael 2021-11-04 20:32:16 +00:00
parent 95622a0f0d
commit 6a349e7fd9
15 changed files with 38 additions and 25 deletions

View file

@ -36,6 +36,7 @@ use Friendica\DI;
use Friendica\Model\Item;
use Friendica\Model\Post;
use Friendica\Model\User;
use Friendica\Network\HTTPException\UnauthorizedException;
function windowsphonepush_install()
{
@ -436,8 +437,7 @@ function windowsphonepush_login(App $a)
if (!isset($_SERVER['PHP_AUTH_USER'])) {
Logger::info('API_login: ' . print_r($_SERVER, true));
header('WWW-Authenticate: Basic realm="Friendica"');
header('HTTP/1.0 401 Unauthorized');
die('This api requires login');
throw new UnauthorizedException('This api requires login');
}
$user_id = User::authenticate($_SERVER['PHP_AUTH_USER'], trim($_SERVER['PHP_AUTH_PW']));
@ -447,8 +447,7 @@ function windowsphonepush_login(App $a)
} else {
Logger::info('API_login failure: ' . print_r($_SERVER, true));
header('WWW-Authenticate: Basic realm="Friendica"');
header('HTTP/1.0 401 Unauthorized');
die('This api requires login');
throw new UnauthorizedException('This api requires login');
}
DI::auth()->setForUser($a, $record);