diff --git a/admin/setup_mvp.php b/admin/setup_mvp.php
index 457db23..4e7879f 100644
--- a/admin/setup_mvp.php
+++ b/admin/setup_mvp.php
@@ -37,17 +37,22 @@ $form = new Form($db);
// Handle form submission
$action = GETPOST('action', 'alpha');
if ($action == 'update_mappings') {
- $ca3_definitions = $config->getCA3LineDefinitions();
-
- foreach ($ca3_definitions as $line => $definition) {
- $account_codes = GETPOST('account_codes_' . $line, 'array');
+ // CSRF protection
+ if (!checkToken()) {
+ setEventMessages($langs->trans("ErrorCSRFToken"), null, 'errors');
+ } else {
+ $ca3_definitions = $config->getCA3LineDefinitions();
- if (!empty($account_codes)) {
- $config->updateAccountMapping($line, $account_codes);
+ foreach ($ca3_definitions as $line => $definition) {
+ $account_codes = GETPOST('account_codes_' . $line, 'array');
+
+ if (!empty($account_codes)) {
+ $config->updateAccountMapping($line, $account_codes);
+ }
}
+
+ setEventMessages($langs->trans("ConfigurationUpdated"), null, 'mesgs');
}
-
- setEventMessages($langs->trans("ConfigurationUpdated"), null, 'mesgs');
}
// Get current mappings
@@ -72,6 +77,7 @@ print '
';
// Print configuration form
print '