[英]Ambethia recaptcha does not work
I am Using Ambethia recaptcha for a voting system.I have followed all the standard guidelines.But, recaptcha is not validated.I ran console in Firebug and i got this in the response: 我正在将Ambethia recaptcha用于投票系统。我已遵循所有标准指南。但是,Recaptcha未通过验证。我在Firebug中运行了控制台,并在响应中得到了这一点:
Recaptcha::RecaptchaError
in IndicesController#increment
</h1>
<pre>uninitialized constant Recaptcha::Verify::Net</pre>
Is this the problem with code or is it because of webrick server? 这是代码的问题还是由于webrick服务器?
Edit: Here's my controller: 编辑:这是我的控制器:
class IndexController < ApplicationController
def display
@digits=Digit.all
end
def increment
@digit= Digit.find(params[:id])
if verify_recaptcha
@digit.increment!(:value)
respond_to do |format|
format.js
end
else
respond_to do |format|
format.js {render 'fail.js.erb'}
end
end
end
end
here is the view: 这是视图:
<%@digits.each do |c|%>
<h1><%=c.value%></h1>
<p id="fail" style="display:none">Incorrect recaptcha</p>
<p id="para" style="display:none">Succesfully Incremented</p>
<%=recaptcha_tags%>
<%=button_to 'Increment',increment_path(:format=>:js,:id=>c.id),:remote=>true%>
<%end%>
If you use RVM, open the following file: 如果使用RVM,请打开以下文件:
~/.rvm/gems/ name_of_your_gemset /gems/ambethia-recaptcha-0.2.2/lib/recaptcha/rails.rb 〜/ .rvm / gems / name_of_your_gemset /gems/ambethia-recaptcha-0.2.2/lib/recaptcha/rails.rb
And make sure you have the following two lines at the top: 并确保顶部有以下两行:
require 'net/http'
require 'recaptcha'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.