1
0
Fork 0
mirror of https://gitlab.com/SIGBUS/nyaa.git synced 2024-12-22 18:20:01 +00:00

account: force ASCII usernames on login form

Our database doesn't like it when we check for unicode data in
a column that stores ASCII data, so let's stop it before it
gets that far.
This commit is contained in:
Nicolas F 2019-02-23 12:49:21 +01:00
parent da931875bc
commit fd39525ada

View file

@ -26,6 +26,9 @@ def login():
return flask.redirect(flask.url_for('account.login')) return flask.redirect(flask.url_for('account.login'))
username = form.username.data.strip() username = form.username.data.strip()
if not username.isascii():
flask.flash('Invalid characters in username.', 'danger')
return flask.redirect(flask.url_for('account.login'))
password = form.password.data password = form.password.data
user = models.User.by_username(username) user = models.User.by_username(username)