Skip to content

Commit

Permalink
[api][webui] user model: Cleanup hash_string method
Browse files Browse the repository at this point in the history
  • Loading branch information
bgeuken committed Oct 4, 2015
1 parent 9213501 commit f0f95d5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/api/app/models/user.rb
Expand Up @@ -240,7 +240,7 @@ def self.find_with_credentials(login, password)
# This method checks whether the given value equals the password when
# hashed with this user's password hash type. Returns a boolean.
def password_equals?(value)
return hash_string(value) == self.password
hash_string(value) == self.password
end

# Sets the last login time and saves the object. Note: Must currently be
Expand Down Expand Up @@ -980,9 +980,9 @@ def add_globalroles(role_titles)
# Hashes the given parameter by the selected hashing method. It uses the
# "password_salt" property's value to make the hashing more secure.
def hash_string(value)
return case password_hash_type
when 'md5' then Digest::MD5.hexdigest(value + self.password_salt)
end
if password_hash_type == "md5"
Digest::MD5.hexdigest(value + self.password_salt)
end
end

cattr_accessor :lookup_strategy do
Expand Down

0 comments on commit f0f95d5

Please sign in to comment.