mirror of
https://github.com/zulip/zulip.git
synced 2025-10-30 11:33:51 +00:00
ruff: Fix SIM102 nested if statements.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
50cf9bc4b8
commit
b0e569f07c
@@ -1011,11 +1011,10 @@ def json_fetch_api_key(
|
||||
realm = get_realm_from_request(request)
|
||||
if realm is None:
|
||||
raise JsonableError(_("Invalid subdomain"))
|
||||
if password_auth_enabled(user_profile.realm):
|
||||
if not authenticate(
|
||||
request=request, username=user_profile.delivery_email, password=password, realm=realm
|
||||
):
|
||||
raise JsonableError(_("Password is incorrect."))
|
||||
if password_auth_enabled(user_profile.realm) and not authenticate(
|
||||
request=request, username=user_profile.delivery_email, password=password, realm=realm
|
||||
):
|
||||
raise JsonableError(_("Password is incorrect."))
|
||||
|
||||
api_key = get_api_key(user_profile)
|
||||
return json_success(request, data={"api_key": api_key, "email": user_profile.delivery_email})
|
||||
|
||||
Reference in New Issue
Block a user