0
authlogic 및 facebook이있는 레일 앱이 있습니다. 곧 내가 페이스 북에 로그인 한 후 처음, 내 모든 페이지가 응답을 중지하고 로그는 더 많은 반복을 제외하고 authlogic 레일 앱의 무한 루프
Processing UserSessionsController#new (for [IP ADDRESS] at 2010-07-08 00:32:31) [GET]
Parameters: {"action"=>"new", "controller"=>"user_sessions"}
SystemStackError (stack level too deep):
(eval):5:in `connection_handler'
authlogic (2.1.5) lib/authlogic/session/callbacks.rb:83:in `validate'
authlogic (2.1.5) lib/authlogic/session/validation.rb:64:in `valid?'
authlogic (2.1.5) lib/authlogic/session/cookies.rb:110:in `persist_by_cookie'
authlogic (2.1.5) lib/authlogic/session/callbacks.rb:90:in `persist'
authlogic (2.1.5) lib/authlogic/session/persistence.rb:55:in `persisting?'
authlogic (2.1.5) lib/authlogic/session/persistence.rb:39:in `find'
authlogic (2.1.5) lib/authlogic/acts_as_authentic/session_maintenance.rb:96:in `get_session_information'
authlogic (2.1.5) lib/authlogic/acts_as_authentic/session_maintenance.rb:95:in `each'
authlogic (2.1.5) lib/authlogic/acts_as_authentic/session_maintenance.rb:95:in `get_session_information'
authlogic (2.1.5) lib/authlogic/session/callbacks.rb:83:in `validate'
authlogic (2.1.5) lib/authlogic/session/validation.rb:64:in `valid?'
authlogic (2.1.5) lib/authlogic/session/cookies.rb:110:in `persist_by_cookie'
authlogic (2.1.5) lib/authlogic/session/callbacks.rb:90:in `persist'
authlogic (2.1.5) lib/authlogic/session/persistence.rb:55:in `persisting?'
authlogic (2.1.5) lib/authlogic/session/persistence.rb:39:in `find'
authlogic (2.1.5) lib/authlogic/acts_as_authentic/session_maintenance.rb:96:in `get_session_information'
authlogic (2.1.5) lib/authlogic/acts_as_authentic/session_maintenance.rb:95:in `each'
authlogic (2.1.5) lib/authlogic/acts_as_authentic/session_maintenance.rb:95:in `get_session_information'
을 보여줍니다.
여기 내 routes.rb의 : 지속성 토큰을 설정하면 문제를 해결할 수 있음을
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'
map.resource :account, :controller => "users"
map.resources :users
map.resource :user_session
map.root :controller => "user_sessions", :action => "new" # optional, this just sets the root route
This post 힌트, 그러나 그것은 나에게 도움이되지 않았다. user.rb에 대한 코드는 다음과 같습니다. 기본적으로 authlogic w/facebook 데모의 표준 코드입니다.
class User < ActiveRecord::Base
is_gravtastic :email, :filetype => :png, :default => "identicon", :size => 120
validates_uniqueness_of :name, :message => "should be unique!"
def before_connect(facebook_session)
logger.info("HEY FACEBOOK, HOW'S IT GOING? SO LOVELY TO SEE: #{facebook_session.user.name}")
# Authlogic isn't as magic as we thought: tell it we need a persistence token, based on advice
# in http://github.com/binarylogic/authlogic/issuesearch?state=closed&q=persistence#issue/68
self.persistence_token = reset_persistence_token
end
def before_save
if self.name.nil? || self.name.blank?
self.name = "user#{Time.now.to_i}"
end
end
acts_as_authentic do |c|
c.validate_login_field = false
# optional, but if a user registers by openid, he should at least share his email-address with the app
c.validate_email_field = false
c.validate_password_field = false
# fetch email by ax
c.openid_required_fields = [:email,"http://axschema.org/contact/email"]
#c.openid_required_fields = [:language, "http://axschema.org/pref/language"]
end
def before_connect(facebook_session)
self.name = facebook_session.user.name
self.birthday = facebook_session.user.birthday_date
self.about = facebook_session.user.about_me
self.locale = facebook_session.user.locale
#self.website = facebook_session.user.website
end
private
def map_openid_registration(registration)
if registration.empty?
# no email returned
self.email_autoset = false
else
# email by sreg
unless registration["email"].nil? && registration["email"].blank?
self.email = registration["email"]
self.email_autoset = true
else
# email by ax
unless registration['http://axschema.org/contact/email'].nil? && registration['http://axschema.org/contact/email'].first.blank?
self.email = registration['http://axschema.org/contact/email'].first
self.email_autoset = true
else
# registration-hash seems to contain information other than the email-address
self.email_autoset = false
end
end
end
end
end
예. 어떤 제안? 미리 감사드립니다.
그래서 새 세션을 만든 후 사용자를 어디로 보냅니 까? '/'로 리디렉션합니까? Map.root 엔트리로 인해 UserSessionsController # new로 바로 연결될 것입니다. –
UserSessionsController를 보는 것이 유용 할 것입니다. –