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.1.26 lib/devise_phone/hooks.rb
devise_phone-0.1.25 lib/devise_phone/hooks.rb
devise_phone-0.1.24 lib/devise_phone/hooks.rb
devise_phone-0.1.23 lib/devise_phone/hooks.rb
devise_phone-0.1.22 lib/devise_phone/hooks.rb
devise_phone-0.1.21 lib/devise_phone/hooks.rb
devise_phone-0.1.2 lib/devise_phone/hooks.rb
devise_phone-0.1.1 lib/devise_phone/hooks.rb
devise_phone-0.1.0 lib/devise_phone/hooks.rb
devise_phone-0.0.17 lib/devise_phone/hooks.rb
devise_phone-0.0.1667 lib/devise_phone/hooks.rb
devise_phone-0.0.1666 lib/devise_phone/hooks.rb
devise_phone-0.0.1665 lib/devise_phone/hooks.rb
devise_phone-0.0.1664 lib/devise_phone/hooks.rb
devise_phone-0.0.1663 lib/devise_phone/hooks.rb
devise_phone-0.0.1662 lib/devise_phone/hooks.rb
devise_phone-0.0.1661 lib/devise_phone/hooks.rb
devise_phone-0.0.166 lib/devise_phone/hooks.rb
devise_phone-0.0.165 lib/devise_phone/hooks.rb
devise_phone-0.0.164 lib/devise_phone/hooks.rb