mirror of
https://github.com/bitinflow/expose.git
synced 2026-03-13 21:45:55 +00:00
Apply fixes from StyleCI
This commit is contained in:
committed by
StyleCI Bot
parent
0e33bc7d99
commit
83676deddb
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user