"Invalid email or password." no matter what

821 views
Skip to first unread message

Erik M Jacobs

unread,
Dec 31, 2011, 1:25:46 PM12/31/11
to Devise
I have an app that I have been running with two Devise models
successfully for a while. I recently upgraded the application to
Rails 3. I'm now trying to add a model to build an Admin area, and
having issues.

If I create an Admin either from the console or the web, I am
successful.
If I do the "forgot password", the password is reset and the user is
logged in.
If I sign out and attempt to sign back in, I always get "Invalid email
or password."

I notice that on the other models, if I enter an incorrect user/
password, there is still an SQL call made. But on the new Admin
model, there is no SQL call made.
http://pastie.org/3102961 (SQL call for working model)

Here is the core db migration and Admin model:
http://pastie.org/3102968

I'm really not sure what I'm doing wrong here. It must be something
simple, because two other models work.

Rails: 3.1.1
Devise: 1.4.9
Warden: 1.0.6
Centos 5

Appreciate your thoughts and assistance. This is driving me batty.

José Valim

unread,
Dec 31, 2011, 1:41:23 PM12/31/11
to Devise
Can you please reproduce the error in a smaller application?

On Dec 31, 7:25 pm, Erik M Jacobs <erikmjac...@gmail.com> wrote:
> I have an app that I have been running with two Devise models
> successfully for a while.  I recently upgraded the application to
> Rails 3.  I'm now trying to add a model to build an Admin area, and
> having issues.
>
> If I create an Admin either from the console or the web, I am
> successful.
> If I do the "forgot password", the password is reset and the user is
> logged in.
> If I sign out and attempt to sign back in, I always get "Invalid email
> or password."
>
> I notice that on the other models, if I enter an incorrect user/
> password, there is still an SQL call made.  But on the new Admin
> model, there is no SQL call made.http://pastie.org/3102961(SQL call for working model)

José Valim

unread,
Dec 31, 2011, 1:42:12 PM12/31/11
to Devise
Most people find out what has gone wrong when trying to reproduce the
issue... and if you can't figure out after reproducing it, please post
it in the issues tracker and we will take a look when we can.

On Dec 31, 7:41 pm, José Valim <jose.va...@gmail.com> wrote:
> Can you please reproduce the error in a smaller application?
>
> On Dec 31, 7:25 pm, Erik M Jacobs <erikmjac...@gmail.com> wrote:
>
>
>
>
>
>
>
> > I have an app that I have been running with two Devise models
> > successfully for a while.  I recently upgraded the application to
> > Rails 3.  I'm now trying to add a model to build an Admin area, and
> > having issues.
>
> > If I create an Admin either from the console or the web, I am
> > successful.
> > If I do the "forgot password", the password is reset and the user is
> > logged in.
> > If I sign out and attempt to sign back in, I always get "Invalid email
> > or password."
>
> > I notice that on the other models, if I enter an incorrect user/
> > password, there is still an SQL call made.  But on the new Admin
> > model, there is no SQL call made.http://pastie.org/3102961(SQLcall for working model)

Erik M Jacobs

unread,
Dec 31, 2011, 4:29:37 PM12/31/11
to Devise
I tried but am unable to reproduce the error.

Same gemfile
Same migration
Same model
Same database type (mysql2)
Same rack modification to reset the relative URL root

I would be happy to try to troubleshoot deeper but I don't really know
how.

On Dec 31, 1:41 pm, José Valim <jose.va...@gmail.com> wrote:
> Can you please reproduce the error in a smaller application?
>
> On Dec 31, 7:25 pm, Erik M Jacobs <erikmjac...@gmail.com> wrote:
>
>
>
>
>
>
>
> > I have an app that I have been running with two Devise models
> > successfully for a while.  I recently upgraded the application to
> > Rails 3.  I'm now trying to add a model to build an Admin area, and
> > having issues.
>
> > If I create an Admin either from the console or the web, I am
> > successful.
> > If I do the "forgot password", the password is reset and the user is
> > logged in.
> > If I sign out and attempt to sign back in, I always get "Invalid email
> > or password."
>
> > I notice that on the other models, if I enter an incorrect user/
> > password, there is still an SQL call made.  But on the new Admin
> > model, there is no SQL call made.http://pastie.org/3102961(SQLcall for working model)

Erik M Jacobs

unread,
Dec 31, 2011, 4:46:32 PM12/31/11
to Devise
Actually, I am wondering if this is the problem:

config.authentication_keys = [ :login ]

My Admin model does not have a login field. This brings up a
question:

Do all Devise models need to use the same auth key? Is it possible to
have some models with email and some with login?

On Dec 31, 1:41 pm, José Valim <jose.va...@gmail.com> wrote:
> Can you please reproduce the error in a smaller application?
>
> On Dec 31, 7:25 pm, Erik M Jacobs <erikmjac...@gmail.com> wrote:
>
>
>
>
>
>
>
> > I have an app that I have been running with two Devise models
> > successfully for a while.  I recently upgraded the application to
> > Rails 3.  I'm now trying to add a model to build an Admin area, and
> > having issues.
>
> > If I create an Admin either from the console or the web, I am
> > successful.
> > If I do the "forgot password", the password is reset and the user is
> > logged in.
> > If I sign out and attempt to sign back in, I always get "Invalid email
> > or password."
>
> > I notice that on the other models, if I enter an incorrect user/
> > password, there is still an SQL call made.  But on the new Admin
> > model, there is no SQL call made.http://pastie.org/3102961(SQLcall for working model)

Erik M Jacobs

unread,
Dec 31, 2011, 5:03:57 PM12/31/11
to Devise
Looks like the answer is here:
https://github.com/plataformatec/devise/wiki/How-To:-Allow-users-to-sign_in-using-their-username-or-email-address

OK... I guess this issue is resolved! :)

On Dec 31, 4:46 pm, Erik M Jacobs <erikmjac...@gmail.com> wrote:
> Actually, I am wondering if this is the problem:
>
> config.authentication_keys = [ :login ]
>
> My Admin model does not have a login field.  This brings up a
> question:
>
> Do all Devise models need to use the same auth key?  Is it possible to
> have some models with email and some with login?
>
> On Dec 31, 1:41 pm, José Valim <jose.va...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Can you please reproduce the error in a smaller application?
>
> > On Dec 31, 7:25 pm, Erik M Jacobs <erikmjac...@gmail.com> wrote:
>
> > > I have an app that I have been running with two Devise models
> > > successfully for a while.  I recently upgraded the application to
> > > Rails 3.  I'm now trying to add a model to build an Admin area, and
> > > having issues.
>
> > > If I create an Admin either from the console or the web, I am
> > > successful.
> > > If I do the "forgot password", the password is reset and the user is
> > > logged in.
> > > If I sign out and attempt to sign back in, I always get "Invalid email
> > > or password."
>
> > > I notice that on the other models, if I enter an incorrect user/
> > > password, there is still an SQL call made.  But on the new Admin
> > > model, there is no SQL call made.http://pastie.org/3102961(SQLcallfor working model)
Reply all
Reply to author
Forward
0 new messages