diff options
author | Oscar Del Ben <info@oscardelben.com> | 2012-04-24 19:03:59 +0200 |
---|---|---|
committer | Oscar Del Ben <info@oscardelben.com> | 2012-04-24 19:03:59 +0200 |
commit | ffa974d55c99c2e4a10064bf53ae13d04991a67d (patch) | |
tree | 9f55bd34c75cfdf5ce21ad9c289aafd5b5010efb /activemodel/lib | |
parent | 71bd5096beb541866dec7599865b5ea7a693482d (diff) | |
download | rails-ffa974d55c99c2e4a10064bf53ae13d04991a67d.tar.gz rails-ffa974d55c99c2e4a10064bf53ae13d04991a67d.tar.bz2 rails-ffa974d55c99c2e4a10064bf53ae13d04991a67d.zip |
Refactor SecurePassword#authenticate
Diffstat (limited to 'activemodel/lib')
-rw-r--r-- | activemodel/lib/active_model/secure_password.rb | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/activemodel/lib/active_model/secure_password.rb b/activemodel/lib/active_model/secure_password.rb index e7a57cf691..8ab0bccc11 100644 --- a/activemodel/lib/active_model/secure_password.rb +++ b/activemodel/lib/active_model/secure_password.rb @@ -55,11 +55,7 @@ module ActiveModel module InstanceMethodsOnActivation # Returns self if the password is correct, otherwise false. def authenticate(unencrypted_password) - if BCrypt::Password.new(password_digest) == unencrypted_password - self - else - false - end + BCrypt::Password.new(password_digest) == unencrypted_password && self end # Encrypts the password into the password_digest attribute. |