Handle authed but not joined players
Further tighten the race condition gap between players authing and finishing joining. The meaning of last_login is apparently officially the last join time, but if the last successful auth time was later, use that as the known account age.
This commit is contained in:
parent
8d607b360c
commit
1a2d41b0b3
@ -60,6 +60,12 @@ end
|
||||
|
||||
------------------------------------------------------------------------
|
||||
|
||||
local lastauth = {}
|
||||
minetest.register_on_authplayer(function(name, _, is_success)
|
||||
if not is_success then return end
|
||||
lastauth[name] = os_time()
|
||||
end)
|
||||
|
||||
local function check(pname)
|
||||
if protectnames[pname] or minetest.get_player_by_name(pname) then return end
|
||||
|
||||
@ -69,10 +75,14 @@ local function check(pname)
|
||||
|
||||
if data.privileges[noprune] then return end
|
||||
|
||||
local seen = data.last_login
|
||||
local authtime = lastauth[pname]
|
||||
if authtime and authtime > seen then seen = authtime end
|
||||
local now = os_time()
|
||||
local daysago = (now - data.last_login) / 86400
|
||||
local daysago = (now - seen) / 86400
|
||||
if daysago <= maxdays then return end
|
||||
|
||||
lastauth[pname] = nil
|
||||
minetest.log("warning", string_format(
|
||||
"Deleting player %q last seen %0.1f day(s) ago",
|
||||
pname, daysago))
|
||||
|
Loading…
x
Reference in New Issue
Block a user