Disallow annoying chars

This commit is contained in:
dsc 2022-03-23 12:04:02 +02:00
parent dc2e24c1e8
commit 4c2c955ee3

View file

@ -1,3 +1,5 @@
import re
import peewee
from quart import session, redirect, url_for
@ -14,6 +16,9 @@ async def handle_user_login(resp: dict):
username = user['preferred_username']
uid = user['sub']
if not re.match(r"^[a-zA-Z0-9_\.-]+$", username):
raise Exception("bad username")
try:
user = User.select().where(User.id == uid).get()
except peewee.DoesNotExist: