Sha256: add0ca3aad415ccc6f5692c8deb7ccc97fa6d9fa2e2b3fb388759f70c7848a10

Contents?: true

Size: 681 Bytes

Versions: 10

Compression:

Stored size: 681 Bytes

Contents

# Deny user access whenever their account is not active yet. All strategies that inherits from
# Devise::Strategies::Authenticatable and uses the validate already check if the user is active_for_authentication?
# before actively signing them in. However, we need this as hook to validate the user activity
# in each request and in case the user is using other strategies beside Devise ones.
Warden::Manager.after_set_user do |record, warden, options|
  if record && record.respond_to?(:active_for_authentication?) && !record.active_for_authentication?
    scope = options[:scope]
    warden.logout(scope)
    throw :warden, scope: scope, message: record.inactive_message
  end
end

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
devbootsrap-0.0.7 lib/devise/hooks/activatable.rb
devbootsrap-0.0.6 lib/devise/hooks/activatable.rb
devbootsrap-0.0.5 lib/devise/hooks/activatable.rb
devbootsrap-0.0.4 lib/devise/hooks/activatable.rb
devbootsrap-0.0.3 lib/devise/hooks/activatable.rb
devbootsrap-0.0.2 lib/devise/hooks/activatable.rb
devbootsrap-0.0.1 lib/devise/hooks/activatable.rb
devise-bootstrap-0.0.2 lib/devise/hooks/activatable.rb
devise-bootstrap-0.0.1 lib/devise/devise/hooks/activatable.rb
devise-3.2.4 lib/devise/hooks/activatable.rb