ruby on rails - How to verify a user's password in Devise -


i'm having problem matching user password using devise gem in rails. user password stored on db encrypted_password , trying find user password, don't understand how match password form , encrypted_password in db.

user.find_by_email_and_password(params[:user][:email], params[:user][:password]) 

i think better, , more elegant way of doing it:

user = user.find_by_email(params[:user][:email]) user.valid_password?(params[:user][:password]) 

the other method generate digest user instance giving me protected method errors.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -