Appease the linter

This commit is contained in:
amcmanu3 2023-09-04 20:28:55 -04:00
parent b34ecf58c2
commit 4051d98f8f

View File

@ -17,8 +17,14 @@ class ApiUsersUserKeyHandler(BaseApiHandler):
key = self.controller.users.get_user_api_key(key_id) key = self.controller.users.get_user_api_key(key_id)
# does this user id exist? # does this user id exist?
if key is None: if key is None:
self.redirect("/panel/error?error=Invalid Key ID") return self.finish_json(
return 400,
{
"status": "error",
"error": "INVALID DATA",
"error_data": "INVALID KEY",
},
)
if ( if (
str(key.user_id) != str(auth_data[4]["user_id"]) str(key.user_id) != str(auth_data[4]["user_id"])
@ -48,7 +54,7 @@ class ApiUsersUserKeyHandler(BaseApiHandler):
200, 200,
{"status": "ok", "data": data_key}, {"status": "ok", "data": data_key},
) )
else:
if ( if (
str(user_id) != str(auth_data[4]["user_id"]) str(user_id) != str(auth_data[4]["user_id"])
and not auth_data[4]["superuser"] and not auth_data[4]["superuser"]
@ -187,8 +193,14 @@ class ApiUsersUserKeyHandler(BaseApiHandler):
key = self.controller.users.get_user_api_key(key_id) key = self.controller.users.get_user_api_key(key_id)
# does this user id exist? # does this user id exist?
if key is None: if key is None:
self.redirect("/panel/error?error=Invalid Key ID") return self.finish_json(
return 400,
{
"status": "error",
"error": "INVALID DATA",
"error_data": "INVALID KEY",
},
)
# does this user id exist? # does this user id exist?
target_key = self.controller.users.get_user_api_key(key_id) target_key = self.controller.users.get_user_api_key(key_id)