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
1 changed files with 3 additions and 0 deletions

View File

@ -26,6 +26,9 @@ def login():
return flask.redirect(flask.url_for('account.login'))
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
user = models.User.by_username(username)