Permalink
Browse files

Refactor SecurePassword#authenticate

  • Loading branch information...
1 parent 71bd509 commit ffa974d55c99c2e4a10064bf53ae13d04991a67d @oscardelben oscardelben committed Apr 24, 2012
Showing with 1 addition and 5 deletions.
  1. +1 −5 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 ffa974d

Please sign in to comment.