From cc7fa4c59d1ab6256b638300d19263d383785b01 Mon Sep 17 00:00:00 2001 From: Michael Himing Date: Sat, 31 May 2014 21:00:10 +1000 Subject: [PATCH 1/2] Fix username regex in cake plugin --- plugins/cake.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/cake.py b/plugins/cake.py index 109da3fb..9a027c22 100644 --- a/plugins/cake.py +++ b/plugins/cake.py @@ -12,7 +12,7 @@ def cake(inp, action=None): """cake - Gives an awesome cake.""" inp = inp.strip() - if not re.match("^[A-Za-z0-9_|.-\]\[]*$", inp.lower()): + if not re.match("^[A-Za-z_\-\[\]\\^{}|`][A-Za-z0-9_\-\[\]\\^{}|`]*$", inp.lower()): return "I can't give an awesome cake to that user!" cake_type = random.choice(cakes) From 32e6bffe1c3c48fbd829c11b7a58823d02065ea1 Mon Sep 17 00:00:00 2001 From: Michael Himing Date: Sat, 31 May 2014 21:23:08 +1000 Subject: [PATCH 2/2] Just check for spaces when validating cake input --- plugins/cake.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/cake.py b/plugins/cake.py index 9a027c22..f9dcc25c 100644 --- a/plugins/cake.py +++ b/plugins/cake.py @@ -12,8 +12,9 @@ def cake(inp, action=None): """cake - Gives an awesome cake.""" inp = inp.strip() - if not re.match("^[A-Za-z_\-\[\]\\^{}|`][A-Za-z0-9_\-\[\]\\^{}|`]*$", inp.lower()): - return "I can't give an awesome cake to that user!" + if " " in inp: + notice("Invalid username!") + return cake_type = random.choice(cakes) size = random.choice(['small', 'little', 'mid-sized', 'medium-sized', 'large', 'gigantic'])