Only mark device as current if device got touched within last 30 minutes.

This commit is contained in:
Martin Edenhofer 2016-08-18 09:45:26 +02:00
parent eb8144b28b
commit 08782ec52e

View file

@ -16,7 +16,8 @@ class UserDevicesController < ApplicationController
attributes.delete('location_details')
attributes.delete('fingerprint')
if session[:user_device_fingerprint] == device.fingerprint
# mark current device to prevent killing own session via user preferences device management
if session[:user_device_fingerprint] == device.fingerprint && device.updated_at > Time.zone.now - 30.minutes
attributes['current'] = true
end
devices_full.push attributes