From 15a5ecbba2afc8ff9a09eb9d008fe8efe70d968a Mon Sep 17 00:00:00 2001 From: Lee Lawlor Date: Mon, 19 May 2014 11:09:07 -0400 Subject: [PATCH] add honeypot to contact us form --- app/controllers/pages_controller.rb | 4 ++-- app/views/pages/_contact_form.html.erb | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 53df37a..f817f37 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -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 diff --git a/app/views/pages/_contact_form.html.erb b/app/views/pages/_contact_form.html.erb index 839834a..c55bd7c 100644 --- a/app/views/pages/_contact_form.html.erb +++ b/app/views/pages/_contact_form.html.erb @@ -1,4 +1,6 @@ <%= form_tag({:controller => 'pages', :action => 'contact_us', :method => :post}, :class => 'form-horizontal') do %> + +
<%= text_field_tag :email, (current_user.present? ? current_user.email : nil), :class => 'form-control' %>