I need to authenticate a user directly in the console under Devise. How can I do it?

Viewed 11934

I need to do something like this from Rails console to do some testing and experiments:

User.authenticate(username, password)

I'm using Devise, but I have no idea how to do this.

I saw this other answer here

How to sign in a user using Devise from a Rails console?

But I need something cleaner and more direct. If necessary, I just need the algorithm to hash an attempted password with the salt and compare it to the encryped_password.

Is it this?

User.find(1).valid_password?('password123') 
2 Answers
Related