This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
before_save :encrypt_password | |
after_save :clear_password | |
def encrypt_password | |
if password.present? | |
salt = BCrypt::Engine.generate_salt | |
self.encrypted_password= BCrypt::Engine.hash_secret(password, salt) | |
end | |
end | |
def clear_password | |
self.password = nil |