1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Use more semantic method to check password

This commit is contained in:
Rohit Arondekar 2014-12-30 21:27:46 +05:30
parent 0c070ae568
commit a928928c96

View file

@ -99,7 +99,7 @@ module ActiveModel
# user.authenticate('notright') # => false
# user.authenticate('mUc3m00RsqyRe') # => user
def authenticate(unencrypted_password)
BCrypt::Password.new(password_digest) == unencrypted_password && self
BCrypt::Password.new(password_digest).is_password?(unencrypted_password) && self
end
attr_reader :password