Add honeypot field to poll creation form
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:
1 parent
04cbc5bcd3
commit
ffe93a3256
5 files changed
+79
-1
No files matched your search
@@ -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']) ?>
|
||||
|
||||
@@ -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>
|
||||
Reference in new issue
Block a user