Sha256: 12de46bc840eba37b7415ca40774790fa5e2fd6c5de11d546ba4769212f5305b

Contents?: true

Size: 609 Bytes

Versions: 1

Compression:

Stored size: 609 Bytes

Contents

Authenticate.lifecycle.after_authentication name: 'timeoutable after authentication' do |user, session, options|
  if user && user.respond_to?(:last_access_at)
    user.last_access_at = Time.now.utc
    user.save!
  end
end

Authenticate.lifecycle.after_set_user name: 'timeoutable after set_user', except: :authentication do |user, session, options|
  puts "user.respond_to?(:timedout?) #{user.respond_to?(:timedout?).inspect}" if user
  if user && user.respond_to?(:timedout?)
    throw(:failure, 'Your session has expired') if user.timedout?
    user.last_access_at = Time.now.utc
    user.save!
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
authenticate-0.1.0 lib/authenticate/callbacks/timeoutable.rb