From d7fc87685d5a664c5a232fe27c329e4bbdf49f2e Mon Sep 17 00:00:00 2001 From: flashwave Date: Sun, 30 Sep 2018 23:24:15 +0200 Subject: [PATCH] Added basic spambot countermeasure --- public/auth.php | 10 ++++++++++ templates/auth/auth.twig | 3 +++ 2 files changed, 13 insertions(+) diff --git a/public/auth.php b/public/auth.php index 1ca09efa..3e9a4ce5 100644 --- a/public/auth.php +++ b/public/auth.php @@ -340,6 +340,16 @@ MSG; break; } + $checkSpamBot = mb_strtolower($_POST['auth']['meow'] ?? ''); + $spamBotValid = [ + '19', '21', 'nineteen', 'nine-teen', 'nine teen', 'twentyone', 'twenty-one', 'twenty one', + ]; + + if (!in_array($checkSpamBot, $spamBotValid)) { + $authRegistrationError = 'Human only cool club, robots begone.'; + break; + } + $usernameValidation = user_validate_username($authUsername, true); if ($usernameValidation !== '') { $authRegistrationError = $usernameValidationErrors[$usernameValidation]; diff --git a/templates/auth/auth.twig b/templates/auth/auth.twig index fdee2f62..f72185e5 100644 --- a/templates/auth/auth.twig +++ b/templates/auth/auth.twig @@ -33,6 +33,9 @@ name="auth[email]" placeholder="E-mail" value="{{ auth_email|default('') }}" required> + +