Added simple antispam protection to registration
This commit is contained in:
parent
6543dcc8f9
commit
eb2b74fdd4
2 changed files with 9 additions and 0 deletions
|
@ -202,6 +202,11 @@ class UserController extends AbstractController
|
|||
{
|
||||
$this->interceptErrors(function()
|
||||
{
|
||||
$honeypot = ['username', 'mail', 'agree'];
|
||||
foreach ($honeypot as $f)
|
||||
if (InputHelper::get($f))
|
||||
throw new SimpleException('Human verification failed');
|
||||
|
||||
if (InputHelper::get('password1') != InputHelper::get('password2'))
|
||||
throw new SimpleException('Specified passwords must be the same');
|
||||
|
||||
|
|
|
@ -16,6 +16,10 @@ $this->assets->setSubTitle('registration form');
|
|||
|
||||
<p>Registered users can view more content,<br/>upload files and add posts to favorites.</p>
|
||||
|
||||
<div style="display:none"><input name="username"/> Please leave this field blank.</div>
|
||||
<div style="display:none"><input name="mail"/> Please leave this field blank.</div>
|
||||
<div style="display:none"><input type="checkbox" name="agree"/> Please leave this field unchecked.</div>
|
||||
|
||||
<?php
|
||||
$context = new StdClass;
|
||||
$context->name = 'name';
|
||||
|
|
Loading…
Reference in a new issue