~gpcf/misc-patches

Adding a check for passwordless accounts when attempting to log on v1 APPLIED

erstazi: 1
 Adding a check for passwordless accounts when attempting to log on

 1 files changed, 9 insertions(+), 0 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~gpcf/misc-patches/patches/50593/mbox | git am -3
Learn more about email & git

[PATCH] Adding a check for passwordless accounts when attempting to log on Export this patch

---
 init.lua | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/init.lua b/init.lua
index 2ab2e4a..678dec7 100644
--- a/init.lua
+++ b/init.lua
@@ -228,6 +228,12 @@ function xban.get_record(player)
	return record, last_pos
end

function xban.has_password(name)
	local handler = minetest.get_auth_handler()
	local auth = handler.get_auth(name)
	return auth and not minetest.check_password_entry(name, auth.password, "")
end

xban.present = {}

minetest.register_chatcommand("mod_afk", {
@@ -282,6 +288,9 @@ minetest.register_on_prejoinplayer(function(name, ip)
		return ("Banned: Expires: %s, Reason: %s"):format(
		  date, e.reason)
	end
	if not xban.has_password(name) then
		return "This account has been deactivated. Please, contact the server owner on the forums."
	end
	if minetest.settings:get("moderate_new_accounts") and not minetest.player_exists(name) then
		local players = minetest.get_connected_players()
		for i=1,#players do