Skip to content

Commit

Permalink
Merge pull request #1399 from DigitalCurationCentre/issue1394
Browse files Browse the repository at this point in the history
Fix for contact-us when logged in - fixes #1394
  • Loading branch information
briri authored Apr 20, 2018
2 parents 421fad0 + 878fd20 commit 1cbf169
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions app/controllers/contacts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@ class ContactUs::ContactsController < ApplicationController
def create
@contact = ContactUs::Contact.new(params[:contact_us_contact])

if verify_recaptcha(model: @contact) && @contact.save
if !user_signed_in?
unless verify_recaptcha(model: @contact) && @contact.save
flash[:alert] = _('Captcha verification failed, please retry.')
render_new_page and return
end
end
if @contact.save
redirect_to(ContactUs.success_redirect || '/', :notice => _('Contact email was successfully sent.'))
else
flash[:alert] = _('Captcha verification failed, please retry.')
redirect_to request.referrer
#render_new_page
flash[:alert] = _('Unable to submit your request')
render_new_page
end
end

Expand Down

0 comments on commit 1cbf169

Please sign in to comment.