diff options
author | José Valim <jose.valim@gmail.com> | 2012-04-24 10:05:32 -0700 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2012-04-24 10:05:32 -0700 |
commit | c873167402df3425e63ac0c9a7fb2e950dacf3eb (patch) | |
tree | 8a157e3a0f2e830cdfcad6e3c70853ef0595a102 | |
parent | dbef5a0a5bfba403c1de349f308f86c76064bbde (diff) | |
parent | ffa974d55c99c2e4a10064bf53ae13d04991a67d (diff) | |
download | rails-c873167402df3425e63ac0c9a7fb2e950dacf3eb.tar.gz rails-c873167402df3425e63ac0c9a7fb2e950dacf3eb.tar.bz2 rails-c873167402df3425e63ac0c9a7fb2e950dacf3eb.zip |
Merge pull request #5965 from oscardelben/refactor_secure_password_authenticate
Refactor SecurePassword#authenticate
-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. |