Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Add a Security Question to the Join Form
Sometimes Dolphin’s anti-spam tools and reCAPTCHA aren’t enough to keep all the spammers out. The bad bots could be too new for blacklists, and may be using a human service to solve the CAPTCHA. Where these two solutions fail, a simple question may be the answer.
The goal of a security question is to offer a simple problem any human can solve, but will still trip up a bot that’s not able to account for it. This means legitimate users can still join the site easily, while bots are left stumped. This tutorial will show how to add a simple math question to the join form.
From the Admin Panel => Builders => Profile Fields, drag up a
NEW_ITEM field to somewhere on the join form. Somewhere at or towards the end of the form is recommended.
Next, click on the field to edit it. Fill in under the General tab:
- SystemName: SecurityQuestion
- Caption: What is 9 - 5 ?
- Description: Prove you’re not a bot by answering this question.
- Type: Text
Next, switch to the Advanced tab and fill in:
- Mandatory: Checked
- Minimum Value: 1
- Maximum Value: 9
return strtolower($arg0) == '4';
For a different answer, change the '4' in the Check field.
Next, switch to the Messages tab and fill in some error messages. Once done, save the field. You’re all set.
It’s recommended to test the join form to make sure there are no issues. In case it doesn’t work, check the Check code and make sure the answer is correct and there are no stray characters.
You can also ask questions that require a word for an answer. For example:
- Caption: What color is the sky?
return strtolower($arg0) == 'Blue';
- Caption: Who’s the best T20 cricketer?
return strtolower($arg0) == 'AB de Villiers';