Updated captcha, mailing function working
This commit is contained in:
parent
a1eae7543e
commit
d977b83d06
2
Gemfile
2
Gemfile
|
@ -17,7 +17,7 @@ gem "select2-rails", '3.3.1'
|
|||
gem 'kaminari', :git => 'git://github.com/amatsuda/kaminari.git'
|
||||
gem "acts_as_unvlogable"
|
||||
gem 'youtube_it'
|
||||
gem 'negative_captcha'
|
||||
gem 'gotcha'
|
||||
|
||||
# gem "memcached", "~> 1.4.3"
|
||||
# gem "memcache-client"
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
class Panel::Ask::FrontEnd::AskQuestionsController < OrbitWidgetController
|
||||
before_filter :setup_negative_captcha, :only => [:index, :create]
|
||||
|
||||
layout false
|
||||
|
||||
|
@ -14,15 +13,20 @@ class Panel::Ask::FrontEnd::AskQuestionsController < OrbitWidgetController
|
|||
|
||||
def create
|
||||
@ask_question = AskQuestion.new(params[:ask_question])
|
||||
if verify_recaptcha model: @ask_question, private_key: '6Lfl7OESAAAAAD4rl5S16-zjt5yiKNYJ6jsqdwmL'
|
||||
if gotcha_valid? && @ask_question.save
|
||||
@ask_acknowledgement = AskAcknowledgement.first || AskAcknowlegement.new
|
||||
AskMailer.reply(@ask_question).deliver
|
||||
@ask_question.save
|
||||
#@ask_question.save
|
||||
redirect_to root_path
|
||||
AskAdmin.all.each do |ask_admin|
|
||||
AskMailer.notice(ask_admin, @ask_question).deliver
|
||||
Resque.enqueue(SendAskNoticeMail, ask_admin.id, @ask_question.id)
|
||||
end
|
||||
else
|
||||
# @captcha.error will explain what went wrong
|
||||
flash[:notice] = "Please refill human verification"
|
||||
render :action => 'index'
|
||||
end
|
||||
|
||||
#respond_to do |format|
|
||||
# format.js
|
||||
#end
|
||||
|
@ -35,7 +39,7 @@ class Panel::Ask::FrontEnd::AskQuestionsController < OrbitWidgetController
|
|||
secret: "8a056b337dcc34741626c0b2a14dc3a05794abc11a83407f1d8ed1a1c48afec01dcae1ec2f90348981564ee1d05a537253881cf86bf9644ec4695ab797317738",
|
||||
spinner: request.remote_ip,
|
||||
# Whatever fields are in your form
|
||||
fields: [:name, :email, :contect],
|
||||
fields: [:name, :email, :content],
|
||||
params: params
|
||||
)
|
||||
end
|
||||
|
|
|
@ -57,9 +57,11 @@
|
|||
</div>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<%= recaptcha_tags ajax: true, public_key: '6Lfl7OESAAAAAKdxTSSmWSOWlL__04A9AqQzD7_z' %>
|
||||
<%= gotcha_error %>
|
||||
<%= gotcha%>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
||||
<%= f.button t('cancel'), type: 'reset', class: 'btn' %>
|
||||
|
|
Loading…
Reference in New Issue