Skip to content
Browse files

Merge pull request #5965 from oscardelben/refactor_secure_password_au…

…thenticate

Refactor SecurePassword#authenticate
  • Loading branch information...
2 parents dbef5a0 + ffa974d commit c873167402df3425e63ac0c9a7fb2e950dacf3eb @josevalim josevalim committed
Showing with 1 addition and 5 deletions.
  1. +1 −5 activemodel/lib/active_model/secure_password.rb
View
6 activemodel/lib/active_model/secure_password.rb
@@ -55,11 +55,7 @@ def self.attributes_protected_by_default
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.

0 comments on commit c873167

Please sign in to comment.
Something went wrong with that request. Please try again.