This commit is contained in:
aitzol 2022-04-24 19:33:23 +02:00
parent 20ea82d349
commit ae4122cacf
1 changed files with 8 additions and 0 deletions

8
app.py
View File

@ -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])