我在localhost上运行项目:3666
以用户注册的形式重新显示无效的网站密钥。
我使用rails 3.2.22,gem recaptcha v.0.4.0
请参阅下面的文件。
development.rb:
ActiveRecord::Base.logger = Logger.new(STDOUT) if defined?(Rails::Console)
Bdsmgalaxy::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the webserver when you make code changes.
config.cache_classes = false
config.cache_store = :redis_store, 'redis://127.0.0.1:6379/2/bdsmgalaxy_development'
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
# Show full error reports and disable caching
config.consider_all_requests_local = true
# config.action_controller.perform_caching = false
config.action_controller.perform_caching = true
# Don't care if the mailer can't send
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = { :address => "localhost", :port => 1025 }
config.action_mailer.raise_delivery_errors = true
# Print deprecation notices to the Rails logger
config.active_support.deprecation = :log
# Only use best-standards-support built into browsers
config.action_dispatch.best_standards_support = :builtin
# Do not compress assets
config.assets.compress = false
# Expands the lines which load the assets
config.assets.debug = true
# config.action_controller.asset_host = ""
ENV['RECAPTCHA_PUBLIC_KEY'] = 'c6BAAAAAAAAChqRbQZcn_yyyyyyyyyyyyyyyyy'
ENV['RECAPTCHA_PRIVATE_KEY'] = '6Lc6BAAAAAAAAKN3DRm6VA_xxxxxxxxxxxxxxxxx'
end
Rack::MiniProfiler.config.position = 'right'
recaptcha.rb
require 'net/http'
Recaptcha.configure do |config|
config.public_key = ENV['RECAPTCHA_PUBLIC_KEY']
config.private_key = ENV['RECAPTCHA_PRIVATE_KEY']
# Uncomment the following line if you are using a proxy server:
#config.proxy = 'http://localhost:3666'
# Uncomment if you want to use the newer version of the API,
# only works for versions >= 0.3.7:
#config.api_version = 'v2'
end
请告诉我,我,我是如何解决这个问题的。我的设置recaptcha gem有什么问题?
答案 0 :(得分:1)
对于localhost,请使用标签注册:“local”域名“localhost”在google.com/recaptcha/admin#list中拥有“您的电子邮件”并获取您的站点密钥和密钥
配置/ recaptca.rb
Recaptcha.configure do |config|
config.public_key = '6LcauA8TAAAAAGncDdV2pjc8lxWHf7oSiMz9_0OS' << your site key
config.private_key = '6LcauA8TAAAAAJi52ztlkgdTQl9rSO8Y_haSONzO' << your secret key
end