Module: TinyCore::Acts::User::InstanceMethods

Defined in:
lib/tiny_core/acts/user.rb

Instance Method Summary collapse

Instance Method Details

#after_initializeObject



37
38
39
40
41
42
43
# File 'lib/tiny_core/acts/user.rb', line 37

def after_initialize
  if self.role.blank?
    extend ::Role::User
  else
    extend "::Role::#{self.role.classify}".constantize
  end
end

#deliver_password_reset_instructions!Object



45
46
47
48
# File 'lib/tiny_core/acts/user.rb', line 45

def deliver_password_reset_instructions!
  reset_perishable_token!
  PasswordResetsMailer.deliver_password_reset_instructions(self)
end

#guest?Boolean

Returns:

  • (Boolean)


66
67
68
# File 'lib/tiny_core/acts/user.rb', line 66

def guest?
  false
end

#nameObject



62
63
64
# File 'lib/tiny_core/acts/user.rb', line 62

def name
  full_name
end

#reset_password!(password, password_confirmation) ⇒ Object



50
51
52
53
54
55
56
57
58
59
60
# File 'lib/tiny_core/acts/user.rb', line 50

def reset_password!(password, password_confirmation)
  # We need to check for blank password explicitly, because authlogic only performs that check on create.
  if password.blank? || password_confirmation.blank?
    errors.add(:password, I18n.t('authlogic.error_messages.password_blank'))
    return false
  else
    self.password = password
    self.password_confirmation = password_confirmation
    save
  end
end