feat: api error mailing

This commit is contained in:
Bruno Eckhardt committed 2026-03-23 08:18:04 +01:00
1 parent d862ed1102
commit 2bd315efcd
1 file changed
+7 -1
+7 -1
View File
@@ -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;
}