aboutsummaryrefslogtreecommitdiffstats
path: root/admin/category
diff options
context:
space:
mode:
authorThomas Lange <code@nerdmind.de>2021-08-05 17:38:36 +0200
committerThomas Lange <code@nerdmind.de>2021-08-05 17:59:30 +0200
commitde51f59ef9a50bce0ef63a883c590d1feeadca5d (patch)
treeb1e5d51389b069e27dd3391b28516a0214590a8e /admin/category
parent5b2770aa34f0fb329492311080c101c03c493fb3 (diff)
downloadblog-de51f59ef9a50bce0ef63a883c590d1feeadca5d.tar.gz
blog-de51f59ef9a50bce0ef63a883c590d1feeadca5d.tar.xz
blog-de51f59ef9a50bce0ef63a883c590d1feeadca5d.zip
Show error message if CSRF token does not matches
Print an error message for various actions in the administration area if the security token is invalid, instead of silently preventing the user's desired action to perform if the token is invalid for some reason. This change applies for the delete actions on all entity types and also for the login action and the database command execution form; the forms for creating/modifying entities had already shown a CSRF error before.
Diffstat (limited to 'admin/category')
-rw-r--r--admin/category/delete.php16
1 files changed, 10 insertions, 6 deletions
diff --git a/admin/category/delete.php b/admin/category/delete.php
index e92387c..d7b3001 100644
--- a/admin/category/delete.php
+++ b/admin/category/delete.php
@@ -25,13 +25,17 @@ if(!$Category = $CategoryRepository->find(HTTP::GET('id'))) {
#===============================================================================
# Check for delete request
#===============================================================================
-if(HTTP::issetPOST(['token' => Application::getSecurityToken()], 'delete')) {
- try {
- if($CategoryRepository->delete($Category)) {
- HTTP::redirect(Application::getAdminURL('category/'));
+if(HTTP::issetPOST('delete')) {
+ if(HTTP::issetPOST(['token' => Application::getSecurityToken()])) {
+ try {
+ if($CategoryRepository->delete($Category)) {
+ HTTP::redirect(Application::getAdminURL('category/'));
+ }
+ } catch(PDOException $Exception) {
+ $messages[] = $Exception->getMessage();
}
- } catch(PDOException $Exception) {
- $messages[] = $Exception->getMessage();
+ } else {
+ $messages[] = $Language->text('error_security_csrf');
}
}