Fix stack when username is wrong.

This commit is contained in:
Andrew 2022-04-12 18:33:00 -04:00
parent 705da450e7
commit add784df42

View File

@ -102,8 +102,21 @@ class PublicHandler(BaseHandler):
entered_password = bleach.clean(self.get_argument("password"))
# pylint: disable=no-member
try:
user_id = helper_users.get_user_id_by_name(entered_username.lower())
user_data = helper_users.get_user_model(user_id)
except:
error_msg = "Incorrect username or password. Please try again."
# self.clear_cookie("user")
# self.clear_cookie("user_data")
self.clear_cookie("token")
if self.request.query:
self.redirect(
f"/public/login?error_msg={error_msg}&{self.request.query}"
)
else:
self.redirect(f"/public/login?error_msg={error_msg}")
return
# if we don't have a user
if not user_data: