简体   繁体   English

Ambethia recaptcha不起作用

[英]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.

相关问题 如何让Ambethia Recaptcha与simple_form .error_notification一起使用? - How do I get Ambethia Recaptcha to work with simple_form .error_notification? 不带模型的Ruby on Rails残障人士恢复 - Ruby on Rails ambethia recaptcha without model 无法在Rails 2.3.15中安装Ambethia Recaptcha - Trouble installing Ambethia Recaptcha in Rails 2.3.15 在 Webkit 浏览器中提交 Ajax 表单后,Ambethia Recaptcha 无法重新呈现 - Ambethia Recaptcha unable to rerender after Ajax form submission in Webkit browsers 如何使用Ambethia Ruby Gem设置自定义Recaptcha小部件的样式? - How to Style Custom Recaptcha Widget Using Ambethia Ruby Gem? 如何使用rails 3正确安装ambethia / recaptcha - How do I correctly install ambethia/recaptcha with rails 3 在Rails上使用ambethia的reCAPTCHA插件3.覆盖flash消息div默认值? - ambethia's reCAPTCHA plugin on Rails 3. Override flash message div defaults? 为什么我的RoR Ambethia Recaptcha插件/ gem只会返回false? - Why might my RoR Ambethia Recaptcha plugin/gem be returning only false? Google reCAPTCHA 错误:提供的云项目编号不拥有给定的 reCAPTCHA 密钥 - Google reCAPTCHA error: The provided cloud project number does not own the given recaptcha key rspec和recaptcha - rspec and recaptcha
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM