Sha256: 7c142c01f2c3a6359e73242cffeef8cb4630f504cf2c52a0613691a7fbcd7c1b

Contents?: true

Size: 626 Bytes

Versions: 50

Compression:

Stored size: 626 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?
# 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?) && !record.active?
    scope = options[:scope]
    warden.logout(scope)
    throw :warden, :scope => scope, :message => record.inactive_message
  end
end

Version data entries

50 entries across 50 versions & 8 rubygems

Version Path
devise_phone-0.0.162 lib/devise_phone/hooks.rb
devise_phone-0.0.161 lib/devise_phone/hooks.rb
devise_phone-0.0.16 lib/devise_phone/hooks.rb
devise_phone-0.0.15 lib/devise_phone/hooks.rb
devise_phone-0.0.14 lib/devise_phone/hooks.rb
devise_phone-0.0.13 lib/devise_phone/hooks.rb
devise_phone-0.0.12 lib/devise_phone/hooks.rb
devise_phone-0.0.11 lib/devise_phone/hooks.rb
devise_phone-0.0.1 lib/devise_phone/hooks.rb
devise-1.1.9 lib/devise/hooks/activatable.rb
devise-jdguyot-1.2.rc3 lib/devise/hooks/activatable.rb
devise-1.1.8 lib/devise/hooks/activatable.rb
devise-1.2.rc2 lib/devise/hooks/activatable.rb
devise_sms_activable-0.0.9 lib/devise_sms_activable/hooks.rb
devise-jdguyot-1.2.rc2 lib/devise/hooks/activatable.rb
devise-1.1.7 lib/devise/hooks/activatable.rb
devise-1.1.6 lib/devise/hooks/activatable.rb
devise-jdguyot-1.2.rc lib/devise/hooks/activatable.rb
devise-1.1.5 lib/devise/hooks/activatable.rb
devise-1.1.4 lib/devise/hooks/activatable.rb