I'm using Devise to authenticate. However, I have 3 profile types, and I created the rails g devise MODEL command for my users (Admin, dev, and manager), but Devise created a login page for each profile type, I would like to unify and log in using only one page!.
My idea is to create a view by picking up the email and the password and passing it to a custom controller inheriting from ** Devise :: Sessions ** and overwriting the method that logs in, searching the email in the 3 tables and redirecting the user to the Controller responsible for his profile.
How could I do this "manual login" with Devise? Any other solution to this?
How to create multiple login pages with Devise
nr: #1 dodano: 2017-12-31 13:12
One strategy I use is to create a User model (responsible for authentication) and aProfile model that contains the profile data. Then you make a relationship between User has_one Profile and inProfile you add a kind field with the profile type (admin, dev,manager).
From there it's just business rule and pulls the relationship. I hope it has become clear.