feat: api error mailing
This commit is contained in:
1 parent
d862ed1102
commit
2bd315efcd
1 file changed
+7
-1
+7
-1
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
include_once '../controller/DatabaseController.php';
|
||||
include_once '../controller/DataController.php';
|
||||
include_once __DIR__ . '/../modules/Mail.php';
|
||||
|
||||
header("Content-Type: application/json");
|
||||
header("Access-Control-Allow-Origin: *");
|
||||
@@ -22,11 +23,16 @@ $function = $headers['Function'] ?? $headers['function'] ?? '';
|
||||
|
||||
if (!in_array($token, $validTokens)) {
|
||||
http_response_code(401);
|
||||
echo json_encode([
|
||||
$error = json_encode([
|
||||
"error" => "Unauthorized",
|
||||
"debug_received_token" => $token,
|
||||
"debug_all_headers" => $headers
|
||||
]);
|
||||
errorMail(
|
||||
"API Login failed",
|
||||
$error,
|
||||
);
|
||||
echo $error;
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user