Merge pull request 'Disallow annoying chars' (#12) from strict-usernames into master

Reviewed-on: https://git.wownero.com/wownero/YellWOWPages/pulls/12
This commit is contained in:
dsc 2022-03-23 10:06:00 +00:00
commit 881bc61140
1 changed files with 5 additions and 0 deletions

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: