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
141 142 143 |
# File 'app/models/concerns/effective_devise_user.rb', line 141 def active_for_authentication? super && (respond_to?(:archived?) ? !archived? : true) end |
#inactive_message ⇒ Object
145 146 147 |
# File 'app/models/concerns/effective_devise_user.rb', line 145 def (respond_to?(:archived?) && archived?) ? :archived : super end |
#reinvite! ⇒ Object
EffectiveDeviseUser Instance Methods
137 138 139 |
# File 'app/models/concerns/effective_devise_user.rb', line 137 def reinvite! invite! end |
#send_devise_notification(notification, *args) ⇒ Object
Send devise & devise_invitable emails via active job
155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'app/models/concerns/effective_devise_user.rb', line 155 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
150 151 152 |
# File 'app/models/concerns/effective_devise_user.rb', line 150 def valid_password?(password) Rails.env.development? || Rails.env.staging? || super end |