Class: Spree::User
- Inherits:
-
Base
- Object
- Base
- Spree::User
- Includes:
- UserAddress, UserMethods, UserPaymentSource
- Defined in:
- app/models/spree/user.rb
Class Method Summary collapse
- .admin_created? ⇒ Boolean
- .send_reset_password_instructions(attributes = {}, current_store) ⇒ Object
Instance Method Summary collapse
- #admin? ⇒ Boolean
- #send_reset_password_instructions(current_store) ⇒ Object
- #send_reset_password_instructions_notification(token, current_store_id) ⇒ Object
Class Method Details
.admin_created? ⇒ Boolean
22 23 24 |
# File 'app/models/spree/user.rb', line 22 def self.admin_created? User.admin.exists? end |
.send_reset_password_instructions(attributes = {}, current_store) ⇒ Object
30 31 32 33 34 |
# File 'app/models/spree/user.rb', line 30 def self.send_reset_password_instructions(attributes={}, current_store) recoverable = find_or_initialize_with_errors(reset_password_keys, attributes, :not_found) recoverable.send_reset_password_instructions(current_store) if recoverable.persisted? recoverable end |
Instance Method Details
#admin? ⇒ Boolean
26 27 28 |
# File 'app/models/spree/user.rb', line 26 def admin? has_spree_role?('admin') end |
#send_reset_password_instructions(current_store) ⇒ Object
36 37 38 39 40 41 |
# File 'app/models/spree/user.rb', line 36 def send_reset_password_instructions(current_store) token = set_reset_password_token send_reset_password_instructions_notification(token, current_store.id) token end |
#send_reset_password_instructions_notification(token, current_store_id) ⇒ Object
43 44 45 |
# File 'app/models/spree/user.rb', line 43 def send_reset_password_instructions_notification(token, current_store_id) send_devise_notification(:reset_password_instructions, token, { current_store_id: current_store_id }) end |