How to implement attribute login from another table with Devise in Rails 4?

Asked

Viewed 233 times

1

I currently have a Model User who has a relationship has_one with Customer.

In the tables customers have the field CPF that the user informs when to register.

I need to implement a login in which the user infoma the e-mail or CPF to log into the system.

1 answer

0

The Devise documentation has an example of how to solve this. It uses username or e-mail to exemplify, but can easily adapt to CPF or e-mail. Take a look here it’s a bit of a laborious process, so I put the link to you from a strong safe :) .

So, to adapt to your case I believe you’re going to have to alter the behavior of find_for_database_authentication where you get the CPF on the table Customer.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.