mirror of
https://github.com/danielbrendel/hortusfox-web.git
synced 2026-05-08 14:49:41 -05:00
Better handling of invalid tokens
This commit is contained in:
+10
-1
@@ -17,7 +17,16 @@ class ApiController extends BaseController {
|
||||
$token = $_POST['token'];
|
||||
}
|
||||
|
||||
ApiModel::validateKey($token);
|
||||
try {
|
||||
ApiModel::validateKey($token);
|
||||
} catch (\Exception $e) {
|
||||
http_response_code(403);
|
||||
header('Content-Type: application/json');
|
||||
exit(json([
|
||||
'code' => 403,
|
||||
'invalid_token' => $token
|
||||
])->out(true));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user