FIX: Do not update last seen time for suspended users

This commit is contained in:
David Taylor
2018-07-18 16:04:57 +01:00
parent f55ac892e4
commit 2dc3a50dac
2 changed files with 41 additions and 8 deletions

View File

@ -75,14 +75,6 @@ class Auth::DefaultCurrentUserProvider
@env[BAD_TOKEN] = true
end
if current_user && should_update_last_seen?
u = current_user
Scheduler::Defer.later "Updating Last Seen" do
u.update_last_seen!
u.update_ip_address!(request.ip)
end
end
# possible we have an api call, impersonate
if api_key
current_user = lookup_api_user(api_key, request)
@ -127,6 +119,14 @@ class Auth::DefaultCurrentUserProvider
current_user = nil
end
if current_user && should_update_last_seen?
u = current_user
Scheduler::Defer.later "Updating Last Seen" do
u.update_last_seen!
u.update_ip_address!(request.ip)
end
end
@env[CURRENT_USER_KEY] = current_user
end