Module: EffectiveDeviseUser
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/models/concerns/effective_devise_user.rb
Overview
EffectiveDeviseUsr
Mark your user model with devise_for then effective_devise_user
Defined Under Namespace
Modules: Base, ClassMethods
Instance Method Summary collapse
- #active_for_authentication? ⇒ Boolean
- #inactive_message ⇒ Object
-
#reinvite! ⇒ Object
EffectiveDeviseUser Instance Methods.
-
#send_devise_notification(notification, *args) ⇒ Object
Send devise & devise_invitable emails via active job.
-
#valid_password?(password) ⇒ Boolean
Any password will work in development or mode.
Instance Method Details
#active_for_authentication? ⇒ Boolean
139 140 141 |
# File 'app/models/concerns/effective_devise_user.rb', line 139 def active_for_authentication? super && (respond_to?(:archived?) ? !archived? : true) end |
#inactive_message ⇒ Object
143 144 145 |
# File 'app/models/concerns/effective_devise_user.rb', line 143 def (respond_to?(:archived?) && archived?) ? :archived : super end |
#reinvite! ⇒ Object
EffectiveDeviseUser Instance Methods
135 136 137 |
# File 'app/models/concerns/effective_devise_user.rb', line 135 def reinvite! invite! end |
#send_devise_notification(notification, *args) ⇒ Object
Send devise & devise_invitable emails via active job
153 154 155 156 157 158 159 160 161 162 163 164 |
# File 'app/models/concerns/effective_devise_user.rb', line 153 def send_devise_notification(notification, *args) raise('expected args Hash') unless args.respond_to?(:last) && args.last.kind_of?(Hash) if defined?(Tenant) tenant = Tenant.current || raise('expected a current tenant') args.last[:tenant] ||= tenant end wait = (5 if notification == :invitation_instructions && !Rails.env.test?) devise_mailer.send(notification, self, *args).deliver_later(wait: wait) end |
#valid_password?(password) ⇒ Boolean
Any password will work in development or mode
148 149 150 |
# File 'app/models/concerns/effective_devise_user.rb', line 148 def valid_password?(password) Rails.env.development? || Rails.env.staging? || super end |