Module: CoreModels::Models::User

Extended by:
ActiveSupport::Concern
Includes:
Concerns::UserConcerns
Defined in:
lib/core_models/models/user.rb

Instance Method Summary collapse

Methods included from Concerns::UserConcerns

#add_group=, #add_group_membership, #get_role_from_group_membership, #group, #group_names, #has_group?, #has_role?, #has_role_for_group?, #permissions, #remove_group_membership, #role, #role_names, #uniq_permissions

Instance Method Details

#encrypt_passwordObject



41
42
43
44
45
46
# File 'lib/core_models/models/user.rb', line 41

def encrypt_password
  if password.present?
    self.salt = BCrypt::Engine.generate_salt
    self.password = BCrypt::Engine.hash_secret(password, salt)
  end
end

#send_password_resetObject



48
49
50
51
52
53
# File 'lib/core_models/models/user.rb', line 48

def send_password_reset
  generate_token(:password_reset_token)
  self.password_reset_timestamp = Time.zone.now
  save!
  UserMailer.password_reset(self).deliver
end