From 52eef63a8440934a9bfd1800a166ce6bd194d9a9 Mon Sep 17 00:00:00 2001 From: Griatch Date: Mon, 7 Jul 2014 22:31:19 +0200 Subject: [PATCH] Added ban-check also before unloggedin player/character creation. Resolves #536. --- src/commands/default/unloggedin.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/commands/default/unloggedin.py b/src/commands/default/unloggedin.py index a6cb7299ac..04711d6975 100644 --- a/src/commands/default/unloggedin.py +++ b/src/commands/default/unloggedin.py @@ -158,6 +158,18 @@ class CmdUnconnectedCreate(MuxCommand): session.msg(string) return + # Check IP and/or name bans + bans = ServerConfig.objects.conf("server_bans") + if bans and (any(tup[0]==playername.lower() for tup in bans) + or + any(tup[2].match(session.address) for tup in bans if tup[2])): + # this is a banned IP or name! + string = "{rYou have been banned and cannot continue from here." + string += "\nIf you feel this ban is in error, please email an admin.{x" + session.msg(string) + session.execute_cmd("quit") + return + # everything's ok. Create the new player account. try: default_home = ObjectDB.objects.get_id(settings.DEFAULT_HOME)