logesh
logesh

Reputation: 2672

How can i allow user to authenticate using email and some other field in devise instead of email and password?

I am using devise for authentication and i use rails as backend for ios application. I wanted to save the user attributes and it does not have password field in the registration, so i overrided the devise registration controller and made it as required.

Now i wanted to allow the user to be authenticated on the every request, so usually i use "authenticate_user!" method in other controllers so it would check the user on every request but it requires password to do so but in my case i now do not have password, so how can i verify the user on every request.

Can i able to override the authenticate_user! method and allow to check email and type(for example) instead of email and password or tell me if there is some other way.

Also please tell me how devise access the authorization header and use it in the authenticate_user! method. Please help me. I am stuck with this for quiet a long time.

Upvotes: 0

Views: 411

Answers (1)

Bob
Bob

Reputation: 2121

As I answered before, you can override find_first_by_auth_conditions method in User model. See my previous answer please.

Is there a solution for Rails Gem Devise to allow a user to have multiple emails?

Upvotes: 1

Related Questions