1
谷歌我的Rails 3.0.9應用程序, 在我sessions_controller我有認證通過OpenID的
def open_id_authentication(domain=nil)
domain = "" if domain.nil?
complete_identity_url = IDENTITY_URL + domain
authenticate_with_open_id(complete_identity_url, OPENID_OPTS) do |openid_result, identity_url, registration|
if openid_result.successful?
matches = /\/a\/(.*)\/o8/.match(params["openid.op_endpoint"])
google_domain = matches[1] if matches[1]
if valid_account?(google_domain)
account = Account.find_by_google_domain(google_domain)
session[:account_id] = account.id
self.current_user = User.openid_registration(registration, identity_url, account.id)
else
flash[:error] = t('flash.session.domain_not_registered')
redirect_to accounts_path
return false
end
redirect_back_or_default(THIS_path)
else
flash[:error] = t('flash.open_id.authentication_failed')
redirect_to accounts_path
end
end
end
的Gemfile
gem 'ruby-openid', '2.1.8'
gem 'ruby-openid-apps-discovery', '1.2.0'
gem 'open_id_authentication', '1.0.0'
我收到提示行
matches = /\/a\/(.*)\/o8/.match(params["openid.op_endpoint"])
因爲params不包含這樣的密鑰。
之前,該應用程序是Rails 2.3.14和三個列出的寶石是插件。它運行良好。 有人發過這樣的東西,請幫忙。
謝謝!