From eb4618625d9b8636907193adae042b6632bac7e4 Mon Sep 17 00:00:00 2001 From: Trent Robbins Date: Mon, 26 Sep 2016 11:55:49 -0700 Subject: [PATCH] Added support for single quotes, escaped hyphen and converted regex string to raw. --- evennia/commands/default/unloggedin.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/evennia/commands/default/unloggedin.py b/evennia/commands/default/unloggedin.py index 896ce2897..d58dba1a1 100644 --- a/evennia/commands/default/unloggedin.py +++ b/evennia/commands/default/unloggedin.py @@ -277,11 +277,11 @@ class CmdUnconnectedCreate(COMMAND_DEFAULT_CLASS): playername, password = parts # sanity checks - if not re.findall('^[\w. @+-]+$', playername) or not (0 < len(playername) <= 30): + if not re.findall(r"^[\w. @+\-']+$", playername) or not (0 < len(playername) <= 30): # this echoes the restrictions made by django's auth # module (except not allowing spaces, for convenience of # logging in). - string = "\n\r Playername can max be 30 characters or fewer. Letters, spaces, digits and @/./+/-/_ only." + string = "\n\r Playername can max be 30 characters or fewer. Letters, spaces, digits and @/./+/-/_/' only." session.msg(string) return # strip excessive spaces in playername @@ -295,8 +295,8 @@ class CmdUnconnectedCreate(COMMAND_DEFAULT_CLASS): string = "\n\r That name is reserved. Please choose another Playername." session.msg(string) return - if not re.findall('^[\w. @+-]+$', password) or not (3 < len(password)): - string = "\n\r Password should be longer than 3 characers. Letters, spaces, digits and @\.\+\-\_ only." \ + if not re.findall(r"^[\w. @+\-']+$", password) or not (3 < len(password)): + string = "\n\r Password should be longer than 3 characers. Letters, spaces, digits and @/./+/-/_/' only." \ "\nFor best security, make it longer than 8 characters. You can also use a phrase of" \ "\nmany words if you enclose the password in double quotes." session.msg(string)