Can't recover password using email or username.

159 views
Skip to first unread message

Nestor Yavorskyy

unread,
May 22, 2014, 9:36:16 AM5/22/14
to plataforma...@googlegroups.com
I have sign in via login attribute(email / username), all works fine.
Wanted to recover password using one of them.

Added
  config.reset_password_keys = [ :login ]

and in password/new.html
  f.input_field :login

And when i'm clicking submit, i'm getting this

How i can fix this? What i'm doing wrong?
Devise version - 3.2.4

Thanks.

and...@benjamin.dk

unread,
May 23, 2014, 11:09:50 AM5/23/14
to plataforma...@googlegroups.com

Manthan Mallikarjun

unread,
Jun 25, 2014, 1:11:17 AM6/25/14
to plataforma...@googlegroups.com
Yes, yes, yes!

Im also getting the same problem! I made a github issue but it got closed immediately.


Please post there so that it can get re-opened.

thiagocifani

unread,
Jun 25, 2014, 1:23:35 AM6/25/14
to plataforma...@googlegroups.com
it seems you dont have login field on your database. please check it out first


--

---
You received this message because you are subscribed to the Google Groups "Devise" group.
To unsubscribe from this group and stop receiving emails from it, send an email to plataformatec-de...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
thiagocifani

Manthan Mallikarjun

unread,
Jun 25, 2014, 1:25:34 AM6/25/14
to plataforma...@googlegroups.com
Your not supposed to have on. :login is supposed to be an alias for either the username or the email address (whichever is provided). Atleast thats what the tutorial intends.

Login, and registration works fine. Forgot password and Resend confirmation email does not.


Thanks,
Manthan Mallikarjun (http://nahtnam.com)
You know the type, loud as a motorbike but wouldn't bust a grape in a fruit fight - Jay Z 


--

---
You received this message because you are subscribed to a topic in the Google Groups "Devise" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/plataformatec-devise/y6h_OQr8M7k/unsubscribe.
To unsubscribe from this group and all its topics, send an email to plataformatec-de...@googlegroups.com.

André Orvalho

unread,
Jun 25, 2014, 3:29:48 AM6/25/14
to plataforma...@googlegroups.com
So you have followed the instructions on the page I have provided?
Have you checked if there is an issue already opened for this?

So what happens when you try to recover your password?

Can I see your recover password form(maybe in a gist)?

Which version of devise, rails and ruby are you using?

Manthan Mallikarjun

unread,
Jun 25, 2014, 2:35:09 PM6/25/14
to plataforma...@googlegroups.com
Issue is right here: https://github.com/plataformatec/devise/issues/3081

When I try to recover my passsword, I get this error: "PG::UndefinedColumn: ERROR: column users.login does not exist LINE 1: SELECT "users".* FROM "users" WHERE "users"."login" = 'nah... ^ : SELECT "users".* FROM "users" WHERE "users"."login" = 'nahtnam' ORDER BY "users"."id" ASC LIMIT 1"


Ruby: 2.1.1 p76
Rails: 4.1.1
Devise: 3.2.4

The weird part is that it works 100% on my old application:
Ruby: 2.1.1 p76
Rails: 4.0.1
Devise: 3.2.2

Manthan Mallikarjun

unread,
Jun 26, 2014, 1:10:46 AM6/26/14
to plataforma...@googlegroups.com
This has nothing to do with the version number of devise (it might have to do with the version number of rails).


Thanks,
Manthan Mallikarjun (http://nahtnam.com)


--

André Orvalho

unread,
Jun 26, 2014, 4:03:49 AM6/26/14
to plataforma...@googlegroups.com
What about your user model? can I see it on a gist as well?

Lucas Mazza

unread,
Jun 26, 2014, 11:08:22 AM6/26/14
to plataforma...@googlegroups.com
Hey, sorry for the premature close without a proper explanation. The wiki is maintained by the community, and we don't handle outdated instructions or missing steps like this one as real issues since we can't keep up with the wiki and we recommend that users explore the solutions by themselves and contribute back to the wiki with fixes and new solutions for whatever each tutorial might need.

For what is worth, I tried the tutorial a bit and I believe that the following implementation of `find_first_by_auth_conditions` would work for the password recovery with both `username` and `email`. I would like to ask any of you to try it out in your apps and update the wiki page telling a bit more how to get it running. Also the `config.reset_password_keys` config might need to be changed just like the `authentication_keys` one. Also, maybe with this the `find_for_authentication` does not need to be overridden anymore.

def self.find_first_by_auth_conditions(tainted_conditions, options = {})
  if login = tainted_conditions.delete(:login)
    conditions = devise_parameter_filter.filter(value: login.downcase)
    where(['lower(username) = :value OR lower(email) = :value', conditions]).first
  else
    super
  end
end

Hopefully this might help you guys. Also let's keep this discussion on the mailing list and not on the issue tracker.

[]'s
Lucas.



On Thu, Jun 26, 2014 at 5:03 AM, André Orvalho <and...@benjamin.dk> wrote:
What about your user model? can I see it on a gist as well?

--

---
You received this message because you are subscribed to the Google Groups "Devise" group.
To unsubscribe from this group and stop receiving emails from it, send an email to plataformatec-de...@googlegroups.com.

Manthan Mallikarjun

unread,
Jun 26, 2014, 3:44:24 PM6/26/14
to plataforma...@googlegroups.com
Close. For some reason it says: "Login cant be left blank". Im trying everything I can but it still says that login cant be left blank (I am entering stuff in there).
To unsubscribe from this group and stop receiving emails from it, send an email to plataformatec-devise+unsub...@googlegroups.com.

Lucas Mazza

unread,
Jun 26, 2014, 3:57:38 PM6/26/14
to plataforma...@googlegroups.com
Did you changed your 'reset_password_keys' and restarted the app? Also, an example app would be awesome to help you out with this.


To unsubscribe from this group and stop receiving emails from it, send an email to plataformatec-de...@googlegroups.com.

Manthan Mallikarjun

unread,
Jun 26, 2014, 9:00:08 PM6/26/14
to plataforma...@googlegroups.com
​Yep. I have config.reset_password_keys = [ :login ] and I have restarted my app plenty of times. Did you get it working? Can you push it to a github repo so that I can compare your to mine?


Thanks,
Manthan Mallikarjun (http://nahtnam.com)


You received this message because you are subscribed to a topic in the Google Groups "Devise" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/plataformatec-devise/y6h_OQr8M7k/unsubscribe.
To unsubscribe from this group and all its topics, send an email to plataformatec-de...@googlegroups.com.

Manthan Mallikarjun

unread,
Jul 2, 2014, 4:24:53 PM7/2/14
to plataforma...@googlegroups.com
I got it! I used the same code as the wiki and replaced the database_authentication thing with `self.find_first_by_auth_conditions`
To unsubscribe from this group and stop receiving emails from it, send an email to plataformatec-devise+unsubscrib...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--

---
You received this message because you are subscribed to the Google Groups "Devise" group.
To unsubscribe from this group and stop receiving emails from it, send an email to plataformatec-devise+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--

---
You received this message because you are subscribed to a topic in the Google Groups "Devise" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/plataformatec-devise/y6h_OQr8M7k/unsubscribe.
To unsubscribe from this group and all its topics, send an email to plataformatec-devise+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages