Skip to content

Instantly share code, notes, and snippets.

@muZk
Last active August 29, 2015 14:00
Show Gist options
  • Save muZk/11202624 to your computer and use it in GitHub Desktop.
Save muZk/11202624 to your computer and use it in GitHub Desktop.
def valid_password?(password)
self.password_hash == BCrypt::Engine.hash_secret(password, self.password_salt)
end
def encrypt_password
if password.present?
self.password_salt = BCrypt::Engine.generate_salt
self.password_hash = BCrypt::Engine.hash_secret(password, password_salt)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment