Class: ProductionUser
- Inherits:
-
User
- Object
- User
- ProductionUser
- Defined in:
- lib/models/production_user.rb
Overview
because user passwords are hashed both on a production server, and locally, a random salt can’t be added to the password. clients will send the hashed version of the password, so a simple comparison to the stored password is ok.
Instance Method Summary collapse
- #create_salt_and_hash_password ⇒ Object
- #hash_password ⇒ Object
- #passwords_match?(password) ⇒ Boolean
Instance Method Details
#create_salt_and_hash_password ⇒ Object
5 6 7 |
# File 'lib/models/production_user.rb', line 5 def create_salt_and_hash_password self.password_salt = nil end |
#hash_password ⇒ Object
9 10 11 12 |
# File 'lib/models/production_user.rb', line 9 def hash_password return unless password_changed? && password? self.password = Password.hashed_password(nil, password) end |
#passwords_match?(password) ⇒ Boolean
14 15 16 |
# File 'lib/models/production_user.rb', line 14 def passwords_match?(password) self.password_was == password ? self : nil end |