From ae4122cacfce3f6b8374c5fc9e7998558056a257 Mon Sep 17 00:00:00 2001 From: aitzol Date: Sun, 24 Apr 2022 19:33:23 +0200 Subject: [PATCH] fixes --- app.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app.py b/app.py index fd46304..55244c9 100644 --- a/app.py +++ b/app.py @@ -111,8 +111,14 @@ def post_user(): def error(msg): return index_tpl(alerts=[('error', msg, 'fadeOut')], str=i18n.str) + def username_validation(e): + regex = r'^\w+$' + return(bool(re.fullmatch(regex, e))) + if len(form('username')) < 3: return error(i18n.msg[1]) + elif not username_validation(form('username')): + return error(i18n.msg[6]) if len(form('password')) < 1: return error(i18n.msg[2]) @@ -178,6 +184,8 @@ def post_signup(): surname = form('surname').lower() email = form('email').lower() + if not email_validation(email): + return error(i18n.msg[14]) if form('password') != form('confirm-password'): return error(i18n.msg[7])