#79 ✓resolved

current_user() different after UserSession.save with password save vs. OpenID save

Reported by Daniel | April 3rd, 2009 @ 05:59 PM

Hi Ben,

authlogic v2.0.5
authlogic_openid v1.0.3

current_user() correctly returns the newly logged in user object immediately after saving the user session with a password, but returns nil when after saving with an OpenID.

Sample code:
@user_session.save do |result| if result if current_user().login_count == 1 && !current_user().is_admin?

The third line executes fine when logging in with a password, but throws a "nil" error when logging in with OpenID. Note that the login was successful (as indicated both by "result" and by the fact that if I manually alter the address in the address bar to a URL within my application, the OpenID user is logged in).



Comments and changes to this ticket

  • Ben Johnson

    Ben Johnson April 3rd, 2009 @ 06:24 PM

    • State changed from “new” to “open”

    I'm unclear what the error is. Can you give me more info and maybe do a little debugger? Is the session nil or the session.record? It really doesn't make sense because the same method for openid is nothing crazy:

    def save(&block)
            block = nil if !openid_identifier.blank?
  • Ben Johnson

    Ben Johnson April 3rd, 2009 @ 06:46 PM

    Yeah, I'll see if I can find out what's going on. I bet if you did this instead:

    puts UserSession.find

    You would get an object instead of nil. My guess is that the

    return @current_user_session if defined?(@current_user_session)

    Is returning nil because it is set some how.

  • Ben Johnson

    Ben Johnson April 3rd, 2009 @ 07:48 PM

    • State changed from “open” to “resolved”

    This is fixed, update from the repo. I will release an update shortly.

  • veres

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Object based authentication solution that handles all of the non sense for you. It's as easy as ActiveRecord is with a database.

People watching this ticket