Answer the question
In order to leave comments, you need to log in
Login to the admin panel. How to build an authentication system correctly? Rails
Hello Habr!
Actually the question is this: there is an admin panel, of course, only the admin should enter there, and of course, there is only one admin. The question is how to remember the login password. Create a table in the database for one record? Or just register in the controller or in the model? If you register in the model or in the controller, how safe is it?
Answer the question
In order to leave comments, you need to log in
Store in some config (config/secrets.yml for example) salt and hashed password. During login, hash the entered password with the salt from the config and compare with the value from the config.
In general, I see nothing wrong with using https://github.com/plataformatec/devise with the only included module: database_authenticatable.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question