Sha256: 491bbf8e490f308970e5e44dc1df18c0e9d9bad7268cbfaf8d7188a6612e12db

Contents?: true

Size: 520 Bytes

Versions: 24

Compression:

Stored size: 520 Bytes

Contents

# frozen_string_literal: true

# Deny user access whenever their account is not active yet.
# We need this as hook to validate the user activity on 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

24 entries across 23 versions & 4 rubygems

Version Path
devise-4.4.3 lib/devise/hooks/activatable.rb
devise-4.4.2 lib/devise/hooks/activatable.rb
devise-4.4.1 lib/devise/hooks/activatable.rb
devise-4.4.0 lib/devise/hooks/activatable.rb