Fix: Users with underscores in their name can't log in by underscore.
This commit is contained in:
parent
060e3967fd
commit
12881b02e2
1 changed files with 1 additions and 5 deletions
|
@ -86,14 +86,11 @@ def login_post():
|
||||||
|
|
||||||
username = request.values.get("username")
|
username = request.values.get("username")
|
||||||
|
|
||||||
if not username: abort(400)
|
|
||||||
username = sql_ilike_clean(username.lstrip('@'))
|
|
||||||
|
|
||||||
if not username: abort(400)
|
if not username: abort(400)
|
||||||
if username.startswith('@'): username = username[1:]
|
if username.startswith('@'): username = username[1:]
|
||||||
|
|
||||||
if "@" in username:
|
if "@" in username:
|
||||||
try: account = g.db.query(User).filter(User.email.ilike(username)).one_or_none()
|
try: account = g.db.query(User).filter(User.email.ilike(sql_ilike_clean(username))).one_or_none()
|
||||||
except: return "Multiple users use this email!"
|
except: return "Multiple users use this email!"
|
||||||
else: account = get_user(username, graceful=True)
|
else: account = get_user(username, graceful=True)
|
||||||
|
|
||||||
|
@ -101,7 +98,6 @@ def login_post():
|
||||||
time.sleep(random.uniform(0, 2))
|
time.sleep(random.uniform(0, 2))
|
||||||
return render_template("login.html", failed=True)
|
return render_template("login.html", failed=True)
|
||||||
|
|
||||||
|
|
||||||
if request.values.get("password"):
|
if request.values.get("password"):
|
||||||
|
|
||||||
if not account.verifyPass(request.values.get("password")):
|
if not account.verifyPass(request.values.get("password")):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue