Skip to content

Commit

Permalink
fix csrf / spam bug
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiasKrais committed May 22, 2023
1 parent b6f4c47 commit 09acc09
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions install.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@
6);
$d2u_multinewsletter_modules[] = new D2UModule('80-4',
'MultiNewsletter YForm Anmeldung',
6);
7);
$d2u_multinewsletter_modules[] = new D2UModule('80-5',
'MultiNewsletter YForm Abmeldung',
3);
4);

$d2u_module_manager = new D2UModuleManager($d2u_multinewsletter_modules, '', 'multinewsletter');
$d2u_module_manager->autoupdate();
Expand Down
4 changes: 2 additions & 2 deletions lib/module_manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ public static function getD2UMultiNewsletterModules()
6);
$d2u_multinewsletter_modules[] = new D2UModule('80-4',
'MultiNewsletter YForm Anmeldung',
6);
7);
$d2u_multinewsletter_modules[] = new D2UModule('80-5',
'MultiNewsletter YForm Abmeldung',
3);
4);
return $d2u_multinewsletter_modules;
}
}
3 changes: 1 addition & 2 deletions modules/80/4/output.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,10 @@ function sendActivationMail($yform)

$yform = new rex_yform();
$yform->setFormData(trim($form_data));
$yform->setObjectparams('csrf_protection', false);
$yform->setObjectparams('Error-occured', $addon->getConfig('lang_'. rex_clang::getCurrentId() .'_no_userdata', ''));
$yform->setObjectparams('form_action', rex_getUrl(rex_article::getCurrentId(), rex_clang::getCurrentId()));
$yform->setObjectparams('real_field_names', true);
$yform->setObjectparams('form_name', 'multinewsletter_module_80_4_'. random_int(1, 100));
$yform->setObjectparams('form_name', 'multinewsletter_module_80_4_'. $this->getCurrentSlice()->getId()); /** @phpstan-ignore-line */

// action - showtext
$yform->setActionField('showtext', [$addon->getConfig('lang_'. rex_clang::getCurrentId() .'_confirmation_sent', '')]);
Expand Down
3 changes: 1 addition & 2 deletions modules/80/5/output.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,9 @@ function unsubscribe($email)

$yform = new rex_yform();
$yform->setFormData(trim($form_data));
$yform->setObjectparams('csrf_protection', false);
$yform->setObjectparams('Error-occured', $addon->getConfig('lang_'. rex_clang::getCurrentId() .'_no_userdata', ''));
$yform->setObjectparams('form_action', rex_getUrl(rex_article::getCurrentId(), rex_clang::getCurrentId()));
$yform->setObjectparams('form_name', 'multinewsletter_module_80_5_'. random_int(1, 100));
$yform->setObjectparams('form_name', 'multinewsletter_module_80_5_'. $this->getCurrentSlice()->getId()); /** @phpstan-ignore-line */
$yform->setObjectparams('real_field_names', true);

echo $yform->getForm();
Expand Down
5 changes: 3 additions & 2 deletions pages/help.changelog.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<fieldset>
<legend>MultiNewsletter Changelog</legend>
<p>3.5.4-DEV</p>
<p>3.5.4</p>
<ul>
<li>...</li>
<li>Modul 80-4 "MultiNewsletter YForm Anmeldung": Fehler im Spamschutz / CSRF Schutz behoben.</li>
<li>Modul 80-5 "MultiNewsletter YForm Abmeldung": Fehler im Spamschutz / CSRF Schutz behoben.</li>
</ul>
<p>3.5.3</p>
<ul>
Expand Down

0 comments on commit 09acc09

Please sign in to comment.