Class: Kryptonite::User
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Kryptonite::User
- Defined in:
- app/models/kryptonite/user.rb
Instance Attribute Summary collapse
-
#notify_of_new_password ⇒ Object
Returns the value of attribute notify_of_new_password.
Class Method Summary collapse
Instance Method Summary collapse
- #check_time_zone ⇒ Object
- #is_admin? ⇒ Boolean
- #send_create_notification ⇒ Object
- #send_password_reset_instructions ⇒ Object
- #send_update_notification ⇒ Object
Instance Attribute Details
#notify_of_new_password ⇒ Object
Returns the value of attribute notify_of_new_password.
15 16 17 |
# File 'app/models/kryptonite/user.rb', line 15 def notify_of_new_password @notify_of_new_password end |
Class Method Details
.has_more_than_one_admin ⇒ Object
28 29 30 |
# File 'app/models/kryptonite/user.rb', line 28 def self.has_more_than_one_admin Kryptonite::User.where(:access_level => $KRYPTONITE_USER_ACCESS_LEVEL_ADMIN).count > 1 end |
.table_name ⇒ Object
9 10 11 |
# File 'app/models/kryptonite/user.rb', line 9 def self.table_name self.to_s.gsub("::", "_").tableize end |
Instance Method Details
#check_time_zone ⇒ Object
48 49 50 |
# File 'app/models/kryptonite/user.rb', line 48 def check_time_zone self.time_zone = Rails.configuration.time_zone unless self.time_zone end |
#is_admin? ⇒ Boolean
52 53 54 |
# File 'app/models/kryptonite/user.rb', line 52 def is_admin? access_level == $KRYPTONITE_USER_ACCESS_LEVEL_ADMIN end |
#send_create_notification ⇒ Object
32 33 34 |
# File 'app/models/kryptonite/user.rb', line 32 def send_create_notification Kryptonite::KryptoniteNotification.new_user_information(kryptonite_config_email_from_address, self, kryptonite_config_hostname, @password).deliver end |
#send_password_reset_instructions ⇒ Object
43 44 45 46 |
# File 'app/models/kryptonite/user.rb', line 43 def send_password_reset_instructions reset_perishable_token! Kryptonite::KryptoniteNotification.password_reset_instructions(kryptonite_config_email_from_address, self, kryptonite_config_hostname).deliver end |
#send_update_notification ⇒ Object
36 37 38 39 40 41 |
# File 'app/models/kryptonite/user.rb', line 36 def send_update_notification if notify_of_new_password notify_of_new_password = false Kryptonite::KryptoniteNotification.generate_new_password(kryptonite_config_email_from_address, self, kryptonite_config_hostname, @password).deliver end end |