forked from Mirrorlandia_minetest/minetest
Add /setpassword and /clearpassword logging
This commit is contained in:
parent
d4a6dedc88
commit
1a175c6982
@ -229,21 +229,28 @@ core.register_chatcommand("setpassword", {
|
|||||||
if not toname then
|
if not toname then
|
||||||
return false, "Name field required"
|
return false, "Name field required"
|
||||||
end
|
end
|
||||||
local actstr = "?"
|
local act_str_past = "?"
|
||||||
|
local act_str_pres = "?"
|
||||||
if not raw_password then
|
if not raw_password then
|
||||||
core.set_player_password(toname, "")
|
core.set_player_password(toname, "")
|
||||||
actstr = "cleared"
|
act_str_past = "cleared"
|
||||||
|
act_str_pres = "clears"
|
||||||
else
|
else
|
||||||
core.set_player_password(toname,
|
core.set_player_password(toname,
|
||||||
core.get_password_hash(toname,
|
core.get_password_hash(toname,
|
||||||
raw_password))
|
raw_password))
|
||||||
actstr = "set"
|
act_str_past = "set"
|
||||||
|
act_str_pres = "sets"
|
||||||
end
|
end
|
||||||
if toname ~= name then
|
if toname ~= name then
|
||||||
core.chat_send_player(toname, "Your password was "
|
core.chat_send_player(toname, "Your password was "
|
||||||
.. actstr .. " by " .. name)
|
.. act_str_past .. " by " .. name)
|
||||||
end
|
end
|
||||||
return true, "Password of player \"" .. toname .. "\" " .. actstr
|
|
||||||
|
core.log("action", name .. " " .. act_str_pres
|
||||||
|
.. " password of " .. toname .. ".")
|
||||||
|
|
||||||
|
return true, "Password of player \"" .. toname .. "\" " .. act_str_past
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -257,6 +264,9 @@ core.register_chatcommand("clearpassword", {
|
|||||||
return false, "Name field required"
|
return false, "Name field required"
|
||||||
end
|
end
|
||||||
core.set_player_password(toname, '')
|
core.set_player_password(toname, '')
|
||||||
|
|
||||||
|
core.log("action", name .. " clears password of " .. toname .. ".")
|
||||||
|
|
||||||
return true, "Password of player \"" .. toname .. "\" cleared"
|
return true, "Password of player \"" .. toname .. "\" cleared"
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user