- Devise Model Module
When you install and bootstrap Devise in your project you should see something like this in the model User:Since we want to write our own Authentication Implementation, we must follow suit and write a Model.
Next we need to register our Model with Devise. We use Devise#add_module to do this. We can do this inside the file devise.rb that you can see in the folder config/initializers. Just add it to the top of the file.
Without all of those options, Devise and Rails’ Router won’t know to delegate Requests to SessionController into your Module.
- Warden Strategy
In this scenario, I need to verify that user is active or not. So I created my own Strategy and I added the necessary logic for this project. Inactive users can not do log in.
One important thing. In order to use my new authentication strategy, you must modify your User model and add something like this: