I am using
rails => 3.0.20
authlogic => 3.0.3
before using http basic authentication it is all okay. But after using it, after login successfully with 'http basic user name and pass' I have to log in with application user name and password which is retrived from database. It is also sucessfully done. Then it is redirected to a default method which requires current user. But current user
returns nil
. UserSession.find
also returns nil
any idea about why session objects return nil ?
If you are using authlogic
and rails 3
, I believe it could be work if you add below code in user_session.rb
model:
class UserSession < Authlogic::Session::Base
allow_http_basic_auth false
end
Not sure why this is a problem with this Rails/Authlogic/HTTP combination, but anyways, the fix was to add this one-liner to your UserSession model
Thumbs up to Chris Irish
here I found this in his blog.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.