class Pretzel::Accounts::User

Public Instance Methods

authenticate?(password) click to toggle source
# File lib/pretzel/ext/accounts.rb, line 28
def authenticate?(password)
  if self.password == BCrypt::Engine.hash_secret(password, self.salt)
    true
  else
    false
  end
end
before_save() click to toggle source
# File lib/pretzel/ext/accounts.rb, line 23
def before_save
  self.salt = BCrypt::Engine.generate_salt # Make salt
  self.password = BCrypt::Engine.hash_secret(self.password, self.salt) # Hash password
end