Sha256: 752ad9e5656e5bc4ffe7fbe8e9adac7d994cff5f22c8124c1b234bbc6c656eab

Contents?: true

Size: 683 Bytes

Versions: 83

Compression:

Stored size: 683 Bytes

Contents

# Deny user access whenever his 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 him 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

83 entries across 77 versions & 9 rubygems

Version Path
devise-3.2.2 lib/devise/hooks/activatable.rb
devise-3.2.1 lib/devise/hooks/activatable.rb
devise-3.1.2 lib/devise/hooks/activatable.rb
devise-3.0.4 lib/devise/hooks/activatable.rb
devise-2.2.8 lib/devise/hooks/activatable.rb
devise-3.2.0 lib/devise/hooks/activatable.rb
loyal_devise-2.2.6 lib/devise/hooks/activatable.rb
devise-3.1.1 lib/devise/hooks/activatable.rb
devise-3.1.0 lib/devise/hooks/activatable.rb
devise-2.0.6 lib/devise/hooks/activatable.rb
devise-2.1.4 lib/devise/hooks/activatable.rb
devise-2.2.7 lib/devise/hooks/activatable.rb
devise-3.0.3 lib/devise/hooks/activatable.rb
devise-3.1.0.rc2 lib/devise/hooks/activatable.rb
loyal_devise-2.2.5 lib/devise/hooks/activatable.rb
devise-2.2.6 lib/devise/hooks/activatable.rb
devise-3.0.2 lib/devise/hooks/activatable.rb
devise-3.0.1 lib/devise/hooks/activatable.rb
devise-2.2.5 lib/devise/hooks/activatable.rb
loyal_devise-2.1.10 lib/devise/hooks/activatable.rb