Commit a7558c14 authored by Anton Petrov's avatar Anton Petrov
Browse files

Add honeypot anti-spam field to the contact form

parent 5112e481
......@@ -21,8 +21,12 @@ class ContactForm(forms.Form):
message = forms.CharField()
sender = forms.EmailField()
cc_myself = forms.BooleanField(required=False)
phone = forms.CharField(required=False) # honeypot anti-spam hidden field
def send_email(self):
if self.cleaned_data['phone']:
# this field would only be filled out by a spam bot
return False
subject = '[RNAcentral Contact Us] ' + self.cleaned_data['subject']
sender = self.cleaned_data['sender']
recipients = [local_settings.EMAIL_RNACENTRAL_HELPDESK]
......@@ -48,6 +48,9 @@ Contact us
<label for="emailSubject">Your message</label>
{% endif %}
<textarea type="text" class="form-control" name="message" id="emailMessage" placeholder="" tabindex="2" rows="4">{% if form.message.errors %}{{ form.message.value }}{% endif %}</textarea>
<p style="display: none;">
<input type="text" id="phone" name="phone" placeholder="Please enter your phone number">
<div class="form-group">
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment