Add honeypot field to poll creation form
CI / Deploy / test (push) Successful in 41s
CI / Deploy / deploy (push) Skipped

An invisible "website" field is rendered off-screen in the create form.
If a bot fills it in, the poll is not created and no mail is sent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
gnilebeinandClaude Opus 5.5 committed 2026-11-07 14:34:55 +01:00
1 parent 04cbc5bcd3
commit ffe93a3256
5 files changed
+79 -1

No files matched your search

+1
View File
@@ -30,6 +30,7 @@ $this->assign('title', __('Live-Umfragen ohne Login'));
'required' => true,
'autocomplete' => 'email',
]) ?>
<?= $this->element('honeypot') ?>
<?= $this->element('captcha', ['captcha' => $captcha]) ?>
<p class="hint"><?= __('Wir schicken dir einen geheimen Admin-Link. Die Adresse wird nur dafür verwendet.') ?></p>
<?= $this->Form->button(__('Umfrage erstellen'), ['class' => 'button button--primary']) ?>
+16
View File
@@ -0,0 +1,16 @@
<?php
/**
* Honeypot field against spam bots. Humans never see or reach it (moved
* off-screen, hidden from screen readers, not focusable); bots that fill in
* every field get their request rejected by the controller.
*
* @var \App\View\AppView $this
*/
use App\Controller\HomeController;
?>
<div class="hp-field" aria-hidden="true">
<label for="hp-website"><?= __('Bitte dieses Feld leer lassen') ?></label>
<input type="text" id="hp-website" name="<?= h(HomeController::HONEYPOT_FIELD) ?>" value=""
tabindex="-1" autocomplete="off">
</div>