add honeypot to contact us form

This commit is contained in:
Lee Lawlor 2014-05-19 11:09:07 -04:00
parent 3df1001811
commit 15a5ecbba2
2 changed files with 4 additions and 2 deletions

View File

@ -28,8 +28,8 @@ class PagesController < ApplicationController
# if no message
elsif params[:message].blank?
flash[:alert] = t(:contact_us_no_message)
# else send email
else
# else send email if not a spambot
elsif params[:userlogin].blank?
Mailer.contact_us(params[:email], params[:message]).deliver
flash[:notice] = t(:contact_us_success)
end

View File

@ -1,4 +1,6 @@
<%= form_tag({:controller => 'pages', :action => 'contact_us', :method => :post}, :class => 'form-horizontal') do %>
<input name='userlogin' class='userlogin' />
<div class="form-group">
<label class="col-sm-4 col-xs-3 control-label"><%= t(:email_address).titleize %></label>
<div class="col-sm-4 col-xs-9"><%= text_field_tag :email, (current_user.present? ? current_user.email : nil), :class => 'form-control' %></div>