Added basic spambot countermeasure

This commit is contained in:
flash 2018-09-30 23:24:15 +02:00
parent 939deb5dd5
commit d7fc87685d
2 changed files with 13 additions and 0 deletions

View file

@ -340,6 +340,16 @@ MSG;
break; 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); $usernameValidation = user_validate_username($authUsername, true);
if ($usernameValidation !== '') { if ($usernameValidation !== '') {
$authRegistrationError = $usernameValidationErrors[$usernameValidation]; $authRegistrationError = $usernameValidationErrors[$usernameValidation];

View file

@ -33,6 +33,9 @@
name="auth[email]" placeholder="E-mail" name="auth[email]" placeholder="E-mail"
value="{{ auth_email|default('') }}" required> value="{{ auth_email|default('') }}" required>
<input class="input__text input__text--new auth__input" type="text"
name="auth[meow]" placeholder="What is the outcome of nine plus ten?" required>
<button class="input__button input__button--new">Sign up</button> <button class="input__button input__button--new">Sign up</button>
</div> </div>
</form> </form>