This commit is contained in:
aitzol 2022-04-26 07:13:51 +02:00
parent 3d7d70fd9b
commit c26c87d25f
5 changed files with 3 additions and 1 deletions

4
app.py
View File

@ -292,16 +292,18 @@ def post_change_pwd():
@post('/delete') @post('/delete')
def post_delete(): def post_delete():
form = request.forms.getunicode form = request.forms.getunicode
tools = Tools()
def error(msg): def error(msg):
return delete_tpl(alerts=[('error', msg, 'fadeOut')], str=i18n.str) return delete_tpl(alerts=[('error', msg, 'fadeOut')], str=i18n.str)
try: try:
username = newSession().get()['username'] username = newSession().get()['username']
if(form('username').lower() == username): if(tools.input_validation(form('username')) and form('username').lower() == username):
del_user(username) del_user(username)
else: else:
return(error(i18n.msg[19])) return(error(i18n.msg[19]))
except Error as e: except Error as e:
LOG.warning("Unsuccessful attempt to delete the account: %s" % e) LOG.warning("Unsuccessful attempt to delete the account: %s" % e)
return error(str(e)) return error(str(e))