Skip to content

Commit

Permalink
check recaptcha in create action if Inquiries.use_recaptcha is true
Browse files Browse the repository at this point in the history
  • Loading branch information
William Makley committed Jan 23, 2014
1 parent a0de2a2 commit 8e927c8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/controllers/refinery/inquiries/inquiries_controller.rb
Expand Up @@ -15,7 +15,7 @@ def new
def create
@inquiry = ::Refinery::Inquiries::Inquiry.new(params[:inquiry])

if @inquiry.save
if captcha_passed? && @inquiry.save
if @inquiry.ham? || Refinery::Inquiries.send_notifications_for_inquiries_marked_as_spam
begin
::Refinery::Inquiries::InquiryMailer.notification(@inquiry, request).deliver
Expand All @@ -42,6 +42,14 @@ def find_page
@page = ::Refinery::Page.find_by_link_url("/contact")
end

def captcha_passed?
if ::Refinery::Inquiries.use_recaptcha
verify_recaptcha(:model => @inquiry, :message => "There was a problem with your CAPTCHA input, please try again.")
else
true
end
end

end
end
end

0 comments on commit 8e927c8

Please sign in to comment.