Merge branch 'bug/usernames-can-be-capital' into 'dev'

Fix username case

See merge request crafty-controller/crafty-4!351
This commit is contained in:
Iain Powrie 2022-06-16 16:52:03 +00:00
commit 93e8d8a51d
3 changed files with 4 additions and 3 deletions

View File

@ -338,7 +338,7 @@ class CreateUser(ApiHandler):
self.access_denied(user)
return
new_username = self.get_argument("username")
new_username = self.get_argument("username").lower()
new_pass = self.get_argument("password")
if new_username:

View File

@ -1774,7 +1774,7 @@ class PanelHandler(BaseHandler):
"system user is not editable"
)
user_id = bleach.clean(self.get_argument("id", None))
username = bleach.clean(self.get_argument("username", None))
username = bleach.clean(self.get_argument("username", None).lower())
password0 = bleach.clean(self.get_argument("password0", None))
password1 = bleach.clean(self.get_argument("password1", None))
email = bleach.clean(self.get_argument("email", "default@example.com"))
@ -1943,7 +1943,7 @@ class PanelHandler(BaseHandler):
self.finish()
elif page == "add_user":
username = bleach.clean(self.get_argument("username", None))
username = bleach.clean(self.get_argument("username", None).lower())
if username.lower() == "system":
self.redirect(
"/panel/error?error=Unauthorized access: "

View File

@ -95,6 +95,7 @@ class ApiUsersIndexHandler(BaseApiHandler):
)
username = data["username"]
username = str(username).lower()
password = data["password"]
email = data.get("email", "default@example.com")
enabled = data.get("enabled", True)