Merge pull request 'fix/headerauth-crash-missing-header' (#19) from fix/headerauth-crash-missing-header into master
Reviewed-on: #19
This commit is contained in:
commit
84529c373d
@ -15,6 +15,10 @@ class HeaderAuth
|
||||
*/
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
if (! $request->hasHeader('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