Fixed crash on missing header
This commit is contained in:
parent
acc56a0cdf
commit
8021b9e3e2
@ -15,6 +15,10 @@ class HeaderAuth
|
||||
*/
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
if (is_null($request->header('X-BOTAUTH'))) {
|
||||
return response()
|
||||
->json(["status" => false, "message" => "Unauthorized."], 401);
|
||||
}
|
||||
if (!hash_equals(config('bot.header_auth'), $request->header('X-BOTAUTH'))) {
|
||||
return response('Unauthorized', 401);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user