简体   繁体   中英

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.

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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM