ambethia / recaptcha Goto Github PK
View Code? Open in Web Editor NEWReCaptcha helpers for ruby apps
Home Page: http://github.com/ambethia/recaptcha
License: MIT License
ReCaptcha helpers for ruby apps
Home Page: http://github.com/ambethia/recaptcha
License: MIT License
There is a condition where recaptcha_tags will display errors on the captcha text box before a validation has occurred.
When using recaptcha on a popup window, typing in an empty or invalid re-captcha, the recaptcha_error session is set with the error. Close the window without typing in a correct captcha, and you will see the captcha text field (red) as if it had failed validations, on all subsequent page loads.
This assumes you are passing the model to verify_recaptcha, and using error_messages_for to display form validations.
John
I want show mutiple recaptcha in one page by use this gem.
anyone can help me how deal with this?
thanks a lot
lib/recaptcha.rb
RECAPTCHA_VERIFY_URL = 'http://www.google.com/recaptcha/api' this path not verify for me
i change it to
RECAPTCHA_VERIFY_URL = 'http://www.google.com/recaptcha/api/verify
it work now
Google changed the SSL url this week which is breaking the plugin...please see the below thread
http://groups.google.com/group/recaptcha-announce/browse_thread/thread/c1ff6844420c9e63
i took some time to figure out how to use this as a gem (not plugin) with rails.
may be the following solution for rails 2.3.5 should be included in the docs:
require "recaptcha/rails"
ENV['RECAPTCHA_PUBLIC_KEY'] = 'xxx'
I've installed recapcha gem through Bundler (i.e. I've added gem 'recaptcha' to Gemfile), but recaptcha didn't load until I explicitly added:
require "recaptcha/rails"
in application.rb.
The 0.3.1 is actually broken for Rails 3.x but unpacking the gem with latest commits does work.
Can you please release the updated gem on rubygems?
Anyone experienced anything like this? Has the OCR gotten good enough to beat it?
Over a 3 hour sample, 114 correct recaptchas submitted, 43 failures. 95% spammers at least. Unique IPs, very well done except all the usernames are "word" "two-digits" "word", which helps to see which are real.
None of the bots have done anything more than try to post a link to a casino or other website (which are all nofollowed anyways)
I'm logging the captcha responses and they look sane - doesn't seem to be any easy way to load a recaptcha from the recpatcha_challenge_field token for debugging.
I've tested it as myself and it's def. not accepting invalid inputs.
Any other experiences like this, or suggestions? Thanks!
Tried using the ajax option, as my form is loaded via ajax. I'm getting the javascript error:
"Recaptcha is not defined"
Seems to be related to Prototype, which I'm also using on the smae page.
Any ideas?
Thanks.
Nico
Would be nice if you added an option to "disable" the check in development environment (so that verify_recaptcha would just return true).
The offending line is line 20 of lib/recaptcha/client_helper.rb:
It should be:
html << %{ Recaptcha.create('#{key}', document.getElementById('dynamic_recaptcha')#{options[:display] ? ',RecaptchaOptions' : ''});}
Instead of: html << %{ Recaptcha.create('#{key}', document.getElementById('dynamic_recaptcha')#{options[:display] ? '' : ',RecaptchaOptions'});}
The outcomes for options[:display] are reversed: if there is an options[:display] then add the RecaptchaOptions, otherwise don't bother.
Let me know if I can help further. Cheers for the gem: it's great!
this project does not support passing proxy configuration for captcha validate
I install recaptcha a few day ago and add to my application. Until today, recaptcha was work fine but now it appear the message "recaptcha-not-reachable" everytime, i don't why. whats can be wrong?
Hi
Using ruby 1.8.7, rails 2.3.4 and recaptcha 0.2.2 as a gem, require 'net/http' is mandatory in environment.rb else the verify_captcha method raises a Recaptcha::RecaptchaError exception "uninitialized constant Net::HTTP"
Please require 'net/http' in the init.rb :)
Best
Hi,
We have a registration page in our system which we are protecting using recaptcha. The visual challenge works fine; hence I think my settings are correct. However, when I click the audio challenge, I do not hear any sound. Even clicking 'Play sound again' does not work - the view source do not show link to google recaptcha, just a '#'. Can anyone please point out what can possibly go wrong..?
Any help/suggestion is highly appreciated.
.verify_recaptcha raises exception in Ruby 1.9.1:
Ambethia::ReCaptcha::ReCaptchaError (can't dup Symbol)
Patch: antage@84b128863a7dc9bfe792e286768534dd5338ec82
I took interest in your gem today when I decided I needed to add a captcha to an application I'm working on. Overall, the gem seemed simple and intuitive. I ran into some minimally discussed problems concerning Net::HTTP
and it took me some time to track down the issue.
It looks like your master
branch works fine, but it seems it has been some time since the hosted gem has been updated. I also noticed that your Recaptcha::VERSION
module is way out of date.
This is not a complaint by any stretch. I completely understand being busy and not being able to get to side projects. I just didn't want to jump in offering pull requests without starting a discussion. Would it help you to bring your versioning back into some semantic line? Are there other outlying issues that have prevented you from going ahead with publishing a new gem?
If I can help, please let me know :)
I'm using the reCaptcha gem in my Rails 4 app, and the tag for recaptcha isn't displaying, after reloading the page it renders correctly but I suspect that this is caused for the way Turbolinks works in Rails 4 apps..
Have thought about in update the gem to be compatible with Rails4 apps?
How can I do to avoid this?
Thanks!
The helper currently generates invalid xhtml. Can be fixed with a couple of tweaks:
diff --git a/vendor/gems/recaptcha-0.2.3/lib/recaptcha/client_helper.rb b/vendor/gems/recaptcha-0.2.
index 213ba3e..4ee93df 100644
--- a/vendor/gems/recaptcha-0.2.3/lib/recaptcha/client_helper.rb
+++ b/vendor/gems/recaptcha-0.2.3/lib/recaptcha/client_helper.rb
@@ -22,7 +22,7 @@ module Recaptcha
html << %{</script>\n}
else
html << %{<script type="text/javascript" src="#{uri}/challenge?k=#{key}}
- html << %{#{error ? "&error=#{CGI::escape(error)}" : ""}"></script>\n}
+ html << %{#{error ? "&error=#{CGI::escape(error)}" : ""}"></script>\n}
unless options[:noscript] == false
html << %{<noscript>\n }
html << %{<iframe src="#{uri}/noscript?k=#{key}" }
@@ -32,7 +32,7 @@ module Recaptcha
html << %{<textarea name="recaptcha_challenge_field" }
html << %{rows="#{options[:textarea_rows] ||= 3}" }
html << %{cols="#{options[:textarea_cols] ||= 40}"></textarea>\n }
- html << %{<input type="hidden" name="recaptcha_response_field" value="manual_challenge">}
+ html << %{<input type="hidden" name="recaptcha_response_field" value="manual_challenge" />}
html << %{</noscript>\n}
end
end
In my sinatra application recapcha gem return some errors:
undefined method `remote_ip' for #Sinatra::Request:0x7fdc7e4f8820
file: verify.rb
location: verify_recaptcha
line: 30
I solve this by change in verify.rb request.remote_ip to request.ip
undefined local variable or method `flash' for #MyServer:0x7f9ac350e0c8
file: verify.rb
location: verify_recaptcha
line: 55
This error i solved by adding flash = [] before "unless answer == 'true'"
But if i write correct capcha all works fine, if i wrote wrong answer i got errors like Symbol as array index in line 38 of verify.rb or error about converting symbon to integer. I commented all in unless-else-end exept "return true" and "return false". When i do that - check of capcha retun error or pass from my app.
My test application: https://github.com/ssic7i/samples-here/blob/master/test_http.rb
My view for test application: https://github.com/ssic7i/samples-here/blob/master/check.erb
Method recaptcha_tags throws an error at client_helper.rb line 39 because
html_safe is not available in Rails 2.3.5.
The current version of rails_xss seems to require Rails 2.3.8.
Changing client_helper.rb line 39 to:
return (html.respond_to?(:html_safe) && html.html_safe) || html
fixes the issue.
Recently I tried to add reCapcha to a form submited by remote_form_for method. In order to display reCaptcha properly after submit, I had to pass :ajax=>true option in recaptcha_tags method.
I also tried to customize look and feel of reCaptcha using :display option with something like this:
recaptcha_tags :display=>{:theme=>'white'}, :ajax=>true
but id doesn't seem to work. However, if I use it without :ajax=>true, it works good and display options are working. I could abandon using ajax form to use normal form instead, but that's not a solution for me. Any Ideas?
Recaptcha has stopped working since couple days, Google has apparently changed the server urls http://code.google.com/p/web2py/issues/detail?id=255. Quick fix for now is to override the module Recaptcha with updated urls
module Recaptcha
RECAPTCHA_API_SERVER = 'http://api.recaptcha.net'
RECAPTCHA_API_SECURE_SERVER = 'https://www.google.com/recaptcha/api/'
RECAPTCHA_VERIFY_SERVER = 'https://www.google.com/recaptcha/api/verify'
end
The url's in the gem have to be updated accordingly.
Cheers
Abu
In lib/recaptcha/verify.rb you're adding error messages to the ActiveRecord's error base. Please make these messages localizable!
e.g. line 42 - verify.rb:
model.errors.add :base, options[:message] || "Oops, we failed to validate your word verification response. Please try again."
should look become
model.errors.add :base, options[:message] || t("recaptcha_not_reachable_message")
I'm working on a project where we use ambethia-recaptcha gem and we want to remove all gems from github 'cause the are stoping gem building and eventually gem hosting. Are there any plans to move the gem to gemcutter or rubyforge?
Please, get me posted when you make the move or any other decision.
BTW, thanks for the gem ;)
im having a problem getting the recaptcha script to generate in my modal/overlay partial.
the script im using is
<%= recaptcha_tags :display=>{:theme=>'white', :noscript => false}%>
is what happens when i load in my overlay partial. end result is i cannot see the recaptcha
is what happens when i use the above script in a regular view. and it displays properly.
is there a work around for this?
here is the gist.
I'm using reCaptcha with Authlogic exactly this way, but I'm experiencing a problem.
If you try to register only missing or typing wrong recaptcha it will fail and render the page again raising the recaptcha error.
But if you just click the register button again it will success register the user and tell me that is the second time I logged in in the website.
Do you know what could be hapening in my code?
def create
@user = User.create(params[:user])
respond_to do |format|
if verify_recaptcha(@user) && @user.save
flash[:notice] = 'Success.'
format.html { redirect_to(@user) }
format.xml { render :xml => @user, :status => :created, :location => @user }
else
format.html { render :action => "new" }
format.xml { render :xml => @user.errors, :status => :unprocessable_entity }
end
end
end
Thanks.
Has anyone managed to get this working alongside authlogic-oid? It looks like there is some interference between the two in the way they are programmed (or the way authlogic assumes the create action progresses when using open id).
If anyone has managed to get it working how would I alter the following User create action so that it would work with recaptcha (I have tried various ways of inserting the verify_recaptcha method without stuffing the registration process for open id users but no luck so far).
def create
@user = User.new(params[:user])
@user.save do |result|
if result
create_flash_notice("Successfully registered",:success)
redirect_to dashboard_url
else
create_flash_notice("Unable to register",:error)
render :action => 'new'
end
end
end
The code used at https://github.com/ambethia/recaptcha/blob/master/lib/recaptcha.rb#L30 is not thread safe.
The with_configuration
method is modifying the globaly available Recaptcha::@configuration
variable; which will cause issues.
I would advise either of this two:
Recaptcha.confguration
and Recaptcha.with_configuration
thread based; using an other immutable variable for the process defaults.Hello,
the README says:
respond_to do |format|
if verify_recaptcha(:model => @post,
:message => "Oh! It's error with reCAPTCHA!") && @post.save
# ...
else
# ...
end
end
Wich would NOT work.
The method verify_recaptcha
would add an error to the @post
, but the call to @post.save
will call @post.valid?
, which will clear the errors container of @post
. So at the end, only the errors from @post.valid?
will survive and the error added by verify_recaptche
will disappear.
To solve this, one should validate the model first and then add the recaptcha errors:
respond_to do |format|
post_valid, recaptcha_verified = @post.save,
verify_recaptcha(:model => @post)
if post_valid && recaptcha_verified
# ...
else
# ...
end
end
Switching an app using this gem to run on SSL requires modifying all the views (and, in Typo's case, all the themes you may want to use because the themes all use recaptcha directly).
It would be much better if the default value for :ssl could be set from the configuration rather than in the view.
Why does this gem need to be told whether to use SSL or not? Would it work to use '//www.google.com/recaptcha/api' as the nonssl API URL so the browser will use HTTPS when needed? If not, could it check the URL scheme of the page?
While trying to run the tests, I get the following error with ruby 1.8.7
(in /Users/schmidt/Projekte/github/recaptcha)
./test/verify_recaptcha_test.rb:2:in `require': no such file to load -- rails/version (LoadError)
from ./test/verify_recaptcha_test.rb:2
from /Users/schmidt/.rvm/gems/ruby-1.8.7-p248/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `load'
from /Users/schmidt/.rvm/gems/ruby-1.8.7-p248/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5
from /Users/schmidt/.rvm/gems/ruby-1.8.7-p248/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `each'
from /Users/schmidt/.rvm/gems/ruby-1.8.7-p248/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5
rake aborted!
Command failed with status (1): [/Users/schmidt/.rvm/rubies/ruby-1.8.7-p248...]
I have rails 2.3.5 installed.
What do I need to do, to get the tests running? Should the be either simplified or publicly documented?
lib/recaptcha/verify.rb is using 'flash' which is not available to the merb controller.
You have this line in http://github.com/ambethia/recaptcha/blob/master/lib/recaptcha/client_helper.rb#L9
defined? is a very special beast
☃ /tmp$ ruby -ve 'p(defined? flash ? flash[:recaptcha_error] : "")'
ruby 1.8.7 (2008-08-11 patchlevel 72) [universal-darwin10.0]
nil
☃ /tmp$ ruby19 -ve 'p(defined? flash ? flash[:recaptcha_error] : "")'
ruby 1.9.2dev (2009-09-25 trunk 25091) [x86_64-darwin10.0.0]
"expression"
or
☃ /tmp$ ruby -ve 'p(defined? flash &&= 3)'
ruby 1.8.7 (2008-08-11 patchlevel 72) [universal-darwin10.0]
"assignment"
☃ /tmp$ ruby19 -ve 'p(defined? flash &&= 3)'
ruby 1.9.2dev (2009-09-25 trunk 25091) [x86_64-darwin10.0.0]
"assignment"
You should use defined?(flash) ? flash[:recaptcha_error] : ""
"config/environment.rb"
ENV['RECAPTCHA_PUBLIC_KEY'] = '6LdCbtQSAAAAAL28'
ENV['RECAPTCHA_PRIVATE_KEY'] = '6LdCbtQSAAAAAP'
view:
<%= form_tag params.merge(:action=>"create") do %>
problem:
verify_recaptcha() always returns false. Help me find a bug in the code.
thanks for the earlier.
lib/recaptcha.rb
RECAPTCHA_VERIFY_URL = 'http://www.google.com/recaptcha/api' this path not verify for me
i change it to
RECAPTCHA_VERIFY_URL = 'http://www.google.com/recaptcha/api/verify
it work now
@ambethia: The currently available version of this gem (0.3.4) does not have functionality referenced in the README, specifically the I18n translation methods.
Is there anything preventing the master branch of this project from being tagged and released?
$ rake test
(in /home/tagoh/rpms/BUILDROOT/rubygem-recaptcha-0.3.1-1.fc14.x86_64/usr/lib/ruby/gems/1.8/gems/recaptcha-0.3.1)
You don't have i18n installed in your application. Please add it to your Gemfile and run bundle install
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require': no such file to load -- i18n (LoadError) from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
require'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/i18n.rb:2
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require' from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
require'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/inflector/transliterate.rb:3
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require' from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
require'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/core_ext/string/inflections.rb:3
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require' from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
require'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/core_ext/array/conversions.rb:4
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require' from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
require'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/duration.rb:2
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require' from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
require'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/core_ext/time/calculations.rb:1
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require' from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
require'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/core_ext/string/conversions.rb:3
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require' from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
require'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/core_ext/string.rb:1
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in gem_original_require' from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in
require'
from ./test/verify_recaptcha_test.rb:3
from /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:4:in load' from /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:4 from /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:4:in
each'
from /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:4
rake aborted!
Command failed with status (1): [/usr/bin/ruby -I"lib:test" "/usr/lib/ruby/...]
(See full trace by running task with --trace)
Continue to get this invalid-request-cookie error when attempting to submit form
Wonder if this is an issue with the reCaptcha plugin, the reCaptcha service, or an issue with rails
After checkout revision:a191ac7e45a01cea15be3ac21600a71651ad3f8b
Redmine: 1.2.0/1.2.1
use recaptcha as plugin.
the view helper should mark the generated code to be html_safe!
My recaptcha verification fails in production, the same code works just fine in development. I made sure the public and private keys are correct and the correct keys load in the production enviornment. My production server hostname is "server" and I generated the keys are recaptcha with that name. Where do I even begin to troubleshoot this?
In config.yml
test:
recap_pub_key: 6LcbaboSAAAAADbBxT9yLOJ7CoLWLsuAfZr-aL-H
recap_priv_key: 6LcbaboSAAAAACJMtxxfExG5dm_GcDHuZl9WVjZG
google_js_api: ABQIAAAAi_F8JNAI9__oCG-KzCfTYhTJQa0g3IQ9GZqIMmInSLzwtGDKaBQ6kTvHNGROiENaALqema6YZJEh2Q
development:
recap_pub_key: 6LcbaboSAAAAADbBxT9yLOJ7CoLWLsuAfZr-aL-H
recap_priv_key: 6LcbaboSAAAAACJMtxxfExG5dm_GcDHuZl9WVjZG
google_js_api: ABQIAAAAi_F8JNAI9__oCG-KzCfTYhTJQa0g3IQ9GZqIMmInSLzwtGDKaBQ6kTvHNGROiENaALqema6YZJEh2Q
production:
recap_pub_key: 6LcbaboSAAAAADbBxT9yLOJ7CoLWLsuAfZr-aL-H
recap_priv_key: 6LcbaboSAAAAACJMtxxfExG5dm_GcDHuZl9WVjZG
google_js_api: ABQIAAAAi_F8JNAI9__oCG-KzCfTYhTJQa0g3IQ9GZqIMmInSLzwtGDKaBQ6kTvHNGROiENaALqema6YZJEh2Q
in environment.rb
APP_CONFIG = YAML.load_file("#{RAILS_ROOT}/config/config.yml")[RAILS_ENV]
ENV['RECAPTCHA_PUBLIC_KEY'] = APP_CONFIG['recap_pub_key']
ENV['RECAPTCHA_PRIVATE_KEY'] = APP_CONFIG['recap_priv_key']
ENV['GOOGLE_JS_API'] = APP_CONFIG['google_js_api']
In users_controller.rb
def create
@user = User.new(params[:user])
@user.role = Role.find_by_name('user')
v = verify_recaptcha(:model => @user, :message => "Text entered did not match the image!")
if v
if @user.save_without_session_maintenance
@user.send_later :deliver_activation_instructions!
flash[:notice] = t('users.create.confirmation')
redirect_to root_url
else
render :action => :new
end
else
render :action => :new
end
end
Recaptcha result - false
lng: nil, role_id: 2, posts_count: 0, active: nil, created_at: nil, updated_at: nil, crypted_password: "2754e9333463856a1aaa4a91e5616323866e8833fafc
54e3029...", password_salt: "pdQQJpXxzqHJyNXjYO_M", persistence_token: "7bd973e319a175a7048680850a552667f668ee859b9af137a16...", single_access_token:
"muJOtrpdTXPJ6cQWtZs3", perishable_token: nil, login_count: 0, failed_login_count: 0, last_request_at: nil, current_login_at: nil, last_login_at: ni
l, current_login_ip: nil, last_login_ip: nil, image_file_name: nil, image_content_type: nil, image_file_size: nil, image_updated_at: nil, processing:
true>
Errors for this registration
me: "user1", sex: 0, age: 29, lat: nil, lng: nil, role_id: 2, posts_count: 0, active: nil, created_at: nil, updated_at: nil, crypted_password: "2754e
9333463856a1aaa4a91e5616323866e8833fafc54e3029...", password_salt: "pdQQJpXxzqHJyNXjYO_M", persistence_token: "7bd973e319a175a7048680850a552667f668ee
859b9af137a16...", single_access_token: "muJOtrpdTXPJ6cQWtZs3", perishable_token: nil, login_count: 0, failed_login_count: 0, last_request_at: nil, c
urrent_login_at: nil, last_login_at: nil, current_login_ip: nil, last_login_ip: nil, image_file_name: nil, image_content_type: nil, image_file_size:
nil, image_updated_at: nil, processing: true>, @errors=#<OrderedHash {"base"=>[#<ActiveRecord::Error:0xb0b7c54 @base=#<User id: nil, email: "[email protected]", zip: "88888", processing_vote: false, cached_slug: nil, username: "user1", sex: 0, age: 29, lat: nil, lng: nil, role_id: 2, posts_cou
nt: 0, active: nil, created_at: nil, updated_at: nil, crypted_password: "2754e9333463856a1aaa4a91e5616323866e8833fafc54e3029...", password_salt: "pdQ
QJpXxzqHJyNXjYO_M", persistence_token: "7bd973e319a175a7048680850a552667f668ee859b9af137a16...", single_access_token: "muJOtrpdTXPJ6cQWtZs3", perisha
ble_token: nil, login_count: 0, failed_login_count: 0, last_request_at: nil, current_login_at: nil, last_login_at: nil, current_login_ip: nil, last_l
ogin_ip: nil, image_file_name: nil, image_content_type: nil, image_file_size: nil, image_updated_at: nil, processing: true>, @Attribute=:base, @messa
ge="Text entered did not match the image!", @type="Text entered did not match the image!", @options={}>]}>>
ActionView::TemplateError (uninitialized constant Ambethia::ReCaptcha::Helper::Builder) when using recaptcha_tags
it narrows down to this line in recaptcha.rb
xhtml = Builder::XmlMarkup.new :target => out=(''), :indent => 2 # Because I can.
I'm trying to set up Recaptcha in my rails 3.1 app. After I install gem and set up my public and private keys in a config/initializers/recaptcha.rb
Recaptcha.configure do |config|
config.public_key = '6Ldo....'
config.private_key = '6Ldo.....'
end
I use it like this:
<%= f.buttons do %>
<%= recaptcha_tags %>
<%= f.commit_button %>
<% end %>
controller where I need to check the recaptcha I use verify_recaptcha. And no matter what, 'verify_recaptcha' returns false and so the form posting doesn't succeed.
Recaptcha is not showing at https://secret-journey-2221.herokuapp.com/signup page when I used chrome,even it is working fine in other browsers.
It is working fine at local for chrome.Please provide your suggestions.
Tried setting up recaptcha along with devise, as per: https://github.com/plataformatec/devise/wiki/How-To:-Use-Recaptcha-with-Devise
However, I end up getting the error:
undefined local variable or method `verify_recaptcha' for RegistrationsController:Class
Using rails 3.0.9
This is not working:
recaptcha_tags(lang: 'ru')
Instead it sets the locale to my current location.
I have helper method, that iterates on flash this way: flash.each { |key, msg| html << content_tag(:div, msg, :class => key) }
The https://github.com/ambethia/recaptcha/blob/master/lib/recaptcha/verify.rb#L45 causes trouble in that case, because it adds key to flash hash. I suggest to flash.delete(:recaptcha_error)
instead.
Altough the Ajax version works pretty well changing RecaptchaOptions{lang}, there is no option to change language for the nonscript version, isn't there?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.