[英]gem recaptcha, error - Invalid site key
我在本地主機上運行項目: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有什么問題?
對於本地主機,請在標簽上注冊:“本地”域“本地主機”所有者在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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.