Apply fixes from StyleCI

This commit is contained in:
Marcel Pociot
2020-06-17 10:35:07 +00:00
committed by StyleCI Bot
parent 0e33bc7d99
commit 83676deddb
56 changed files with 189 additions and 316 deletions

View File

@@ -4,10 +4,10 @@ namespace App\Server\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use GuzzleHttp\Psr7\Response;
use function GuzzleHttp\Psr7\str;
use Illuminate\Http\Request;
use Illuminate\Support\Str;
use Ratchet\ConnectionInterface;
use function GuzzleHttp\Psr7\str;
abstract class AdminController extends Controller
{
@@ -16,17 +16,19 @@ abstract class AdminController extends Controller
try {
$authorization = Str::after($request->header('Authorization'), 'Basic ');
$authParts = explode(':', base64_decode($authorization), 2);
list($user, $password) = $authParts;
[$user, $password] = $authParts;
if (! $this->credentialsAreAllowed($user, $password)) {
throw new \InvalidArgumentException('Invalid Login');
}
return true;
} catch (\Throwable $e) {
$httpConnection->send(str(new Response(401, [
'WWW-Authenticate' => 'Basic realm="Expose"'
'WWW-Authenticate' => 'Basic realm="Expose"',
])));
}
return false;
}