mirror of
https://gitlab.com/SIGBUS/nyaa.git
synced 2024-12-22 23:40:00 +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:
parent
da931875bc
commit
fd39525ada
|
@ -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)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue