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
af-devise-2.1.2 lib/devise/hooks/activatable.rb
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/devise-2.0.4/lib/devise/hooks/activatable.rb
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/devise-2.1.0/lib/devise/hooks/activatable.rb
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/devise-2.0.4/lib/devise/hooks/activatable.rb
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/devise-2.1.0/lib/devise/hooks/activatable.rb
sunrise-cms-0.3.1 vendor/bundle/ruby/1.9.1/gems/devise-2.0.4/lib/devise/hooks/activatable.rb
sunrise-cms-0.3.1 vendor/bundle/ruby/1.9.1/gems/devise-2.1.0/lib/devise/hooks/activatable.rb
devise-2.1.2 lib/devise/hooks/activatable.rb
sunrise-cms-0.3.0 vendor/bundle/ruby/1.9.1/gems/devise-2.1.0/lib/devise/hooks/activatable.rb
sunrise-cms-0.3.0 vendor/bundle/ruby/1.9.1/gems/devise-2.0.4/lib/devise/hooks/activatable.rb
rmello-devise-2.1.0.2 lib/devise/hooks/activatable.rb
sunrise-cms-0.3.0.rc vendor/bundle/ruby/1.9.1/gems/devise-2.1.0/lib/devise/hooks/activatable.rb
sunrise-cms-0.3.0.rc vendor/bundle/ruby/1.9.1/gems/devise-2.0.4/lib/devise/hooks/activatable.rb
devise-2.1.0 lib/devise/hooks/activatable.rb
devise-2.1.0.rc2 lib/devise/hooks/activatable.rb
upstream-devise-2.1.0.rc lib/devise/hooks/activatable.rb
devise-2.1.0.rc lib/devise/hooks/activatable.rb
devise-2.0.4 lib/devise/hooks/activatable.rb
devise-2.0.2 lib/devise/hooks/activatable.rb
devise-2.0.1 lib/devise/hooks/activatable.rb