dodanie csrf, oauth 2, dockerfile

This commit is contained in:
Marcin Cieślikowski
2026-03-16 10:43:19 +01:00
parent 56c7ecff6d
commit df448ea7c1
26 changed files with 916 additions and 318 deletions
+7 -1
View File
@@ -10,6 +10,11 @@ if (!$data || empty($data['action']) || empty($data['id'])) {
die(json_encode(['success' => false, 'error' => 'Brak danych']));
}
if (!isValidCsrfToken($data['csrf_token'] ?? null)) {
http_response_code(403);
die(json_encode(['success' => false, 'error' => 'Nieprawidlowy token bezpieczenstwa']));
}
$id = (int)$data['id'];
$action = $data['action'];
@@ -61,6 +66,7 @@ try {
echo json_encode(['success' => false, 'error' => 'Nieznana akcja']);
}
} catch (PDOException $e) {
echo json_encode(['success' => false, 'error' => $e->getMessage()]);
error_log($e->getMessage());
echo json_encode(['success' => false, 'error' => 'Wystapil blad serwera']);
}
?>