mirror of
https://git.wownero.com/wownero/YellWOWPages.git
synced 2024-08-15 01:03:25 +00:00
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:
commit
881bc61140
1 changed files with 5 additions and 0 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
import re
|
||||||
|
|
||||||
import peewee
|
import peewee
|
||||||
from quart import session, redirect, url_for
|
from quart import session, redirect, url_for
|
||||||
|
|
||||||
|
@ -14,6 +16,9 @@ async def handle_user_login(resp: dict):
|
||||||
username = user['preferred_username']
|
username = user['preferred_username']
|
||||||
uid = user['sub']
|
uid = user['sub']
|
||||||
|
|
||||||
|
if not re.match(r"^[a-zA-Z0-9_\.-]+$", username):
|
||||||
|
raise Exception("bad username")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
user = User.select().where(User.id == uid).get()
|
user = User.select().where(User.id == uid).get()
|
||||||
except peewee.DoesNotExist:
|
except peewee.DoesNotExist:
|
||||||
|
|
Loading…
Reference in a new issue