Exception in devise/sessions_controller when calling warden.authenticate!

195 views
Skip to first unread message

Kenton Newby

unread,
Jul 10, 2013, 6:27:07 PM7/10/13
to plataforma...@googlegroups.com
I have an app with two users.  Using devise for auth.

----------
Problem
----------  
One user can login just fine.  One user always gets an "invalid email or password" error.

----------
My Setup
----------  
I'm using pry to drop into a session here:

With the "working" user, I can call warden.authenticate!(auth_options) manually at this point and I get back the user I expect.

With the "failing" user, calling the same method on warden raises an exception.

When I look at the "working" warden object, I can see it has an @user instance variable set to the user I'm expecting.

On my "failing" warden object, @user = nil.

I don't know enough about warden yet to figure out what's going on here...looking into it.  

But I figured I'd post here as well since someone may be able to shed some light on this.

So what's going on here?  Why does that warden object have a nil @user?  It's like @user isn't getting set at some point in the request...so where does that happe?  Or am I thinking about this all wrong?

Thanks

Kenton

and...@benjamin.dk

unread,
Jul 21, 2013, 7:17:38 AM7/21/13
to plataforma...@googlegroups.com
OK,

have you tried and set a new user and see if you can login with that? are you sure you using the right credentials? the way to see it is, example:

1. username/email: "email"
password: "password"

2. Use the hash function on "password" and compare to the value saved on the database.

if its the same, then probably something else is wrong with your user.
Reply all
Reply to author
Forward
0 new messages