Use `password.present?` in DatabaseAuthenticatable strategy

In order to be more clear about the expectations of for authenticating, we use
`password.present?` so there is no confusion about the role of the `valid_password?`
method.

More info: https://github.com/plataformatec/devise/issues/3519
This commit is contained in:
Ian Ker-Seymer 2015-03-17 15:19:23 -06:00
parent 9aa72db365
commit 70ab38839f
No known key found for this signature in database
GPG Key ID: B8C2AE2E3AAB4FF5
1 changed files with 1 additions and 1 deletions

View File

@ -5,7 +5,7 @@ module Devise
# Default strategy for signing in a user, based on their email and password in the database.
class DatabaseAuthenticatable < Authenticatable
def authenticate!
resource = valid_password? && mapping.to.find_for_database_authentication(authentication_hash)
resource = password.present? && mapping.to.find_for_database_authentication(authentication_hash)
encrypted = false
if validate(resource){ encrypted = true; resource.valid_password?(password) }