Sha256: 0a101f6b1cbd6084bf8c39c8e2c0f06f5353b4db51601e0d74d7b868a8d37223
Contents?: true
Size: 709 Bytes
Versions: 32
Compression:
Stored size: 709 Bytes
Contents
# After each sign in, update sign in time, sign in count and sign in IP. Warden::Manager.after_set_user :except => :fetch do |record, warden, options| scope = options[:scope] if Devise.mappings[scope].try(:trackable?) && warden.authenticated?(scope) old_current, new_current = record.current_sign_in_at, Time.now record.last_sign_in_at = old_current || new_current record.current_sign_in_at = new_current old_current, new_current = record.current_sign_in_ip, warden.request.remote_ip record.last_sign_in_ip = old_current || new_current record.current_sign_in_ip = new_current record.sign_in_count ||= 0 record.sign_in_count += 1 record.save(false) end end
Version data entries
32 entries across 27 versions & 7 rubygems