Sha256: ed52ce24aef0d56abb25ce78b52bfd3f409f7d77da2901f33018cd12188c03e7

Contents?: true

Size: 767 Bytes

Versions: 6

Compression:

Stored size: 767 Bytes

Contents

# Each time the user is set we verify if it is still able to really sign in.
# This is done by checking the time frame the user is able to sign in without
# confirming it's account. If the user has not confirmed it's account during
# this time frame, he/she will not able to sign in anymore.
Warden::Manager.after_set_user do |record, warden, options|
  if record && record.respond_to?(:active?) && !record.active?
    scope = options[:scope]
    warden.logout(scope)

    if warden.winning_strategy
      # If winning strategy was set, this is being called after authenticate and
      # there is no need to force a redirect.
      warden.winning_strategy.fail!(:unconfirmed)
    else
      throw :warden, :scope => scope, :message => :unconfirmed
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
devise-0.6.0 lib/devise/hooks/confirmable.rb
devise-0.5.6 lib/devise/hooks/confirmable.rb
devise-0.5.5 lib/devise/hooks/confirmable.rb
devise-0.5.4 lib/devise/hooks/confirmable.rb
devise-0.5.3 lib/devise/hooks/confirmable.rb
devise-0.5.2 lib/devise/hooks/confirmable.rb