mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Fix stack when username is wrong.
This commit is contained in:
parent
705da450e7
commit
add784df42
@ -102,8 +102,21 @@ class PublicHandler(BaseHandler):
|
|||||||
entered_password = bleach.clean(self.get_argument("password"))
|
entered_password = bleach.clean(self.get_argument("password"))
|
||||||
|
|
||||||
# pylint: disable=no-member
|
# pylint: disable=no-member
|
||||||
user_id = helper_users.get_user_id_by_name(entered_username.lower())
|
try:
|
||||||
user_data = helper_users.get_user_model(user_id)
|
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 we don't have a user
|
||||||
if not user_data:
|
if not user_data:
|
||||||
|
Loading…
Reference in New Issue
Block a user