Class: MemberConverge

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/models/member_converge.rb

Instance Method Summary collapse

Instance Method Details

#salted_hash(text) ⇒ Object

Calculates and returns IPB-style salted hash for a given text string



14
15
16
17
18
# File 'lib/models/member_converge.rb', line 14

def salted_hash(text)
  return Digest::MD5.hexdigest(
    Digest::MD5.hexdigest(converge_pass_salt) + Digest::MD5.hexdigest(text)
  )
end

#valid_password?(cleartext) ⇒ Boolean

Verifies if the given clear password matches hash and salt stored in IPB’s database, returns true/false depending on the result

Returns:

  • (Boolean)


9
10
11
# File 'lib/models/member_converge.rb', line 9

def valid_password?(cleartext)
  return salted_hash(cleartext) == converge_pass_hash
end