mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 21:13:36 +00:00
users: Remove unnecessary get_api_key helper.
Using the column name is clearer.
This commit is contained in:
committed by
Tim Abbott
parent
8804c1afaa
commit
a7d513e5ec
@@ -67,7 +67,7 @@ from zerver.lib.subdomains import get_subdomain, is_subdomain_root_or_alias
|
||||
from zerver.lib.typed_endpoint import typed_endpoint
|
||||
from zerver.lib.url_encoding import append_url_query_string
|
||||
from zerver.lib.user_agent import parse_user_agent
|
||||
from zerver.lib.users import get_api_key, get_users_for_api, is_2fa_verified
|
||||
from zerver.lib.users import get_users_for_api, is_2fa_verified
|
||||
from zerver.lib.utils import has_api_key_format
|
||||
from zerver.lib.validator import validate_login_email
|
||||
from zerver.models import (
|
||||
@@ -463,7 +463,7 @@ def finish_desktop_flow(
|
||||
def finish_mobile_flow(request: HttpRequest, user_profile: UserProfile, otp: str) -> HttpResponse:
|
||||
# For the mobile OAuth flow, we send the API key and other
|
||||
# necessary details in a redirect to a zulip:// URL scheme.
|
||||
api_key = get_api_key(user_profile)
|
||||
api_key = user_profile.api_key
|
||||
response = create_response_for_otp_flow(
|
||||
api_key, otp, user_profile, encrypted_key_field_name="otp_encrypted_api_key"
|
||||
)
|
||||
@@ -1028,7 +1028,7 @@ def process_api_key_fetch_authenticate_result(
|
||||
process_client(request, user_profile)
|
||||
RequestNotes.get_notes(request).requester_for_logs = user_profile.format_requester_for_logs()
|
||||
|
||||
api_key = get_api_key(user_profile)
|
||||
api_key = user_profile.api_key
|
||||
return api_key
|
||||
|
||||
|
||||
@@ -1204,7 +1204,7 @@ def json_fetch_api_key(
|
||||
):
|
||||
raise JsonableError(_("Password is incorrect."))
|
||||
|
||||
api_key = get_api_key(user_profile)
|
||||
api_key = user_profile.api_key
|
||||
return json_success(request, data={"api_key": api_key, "email": user_profile.delivery_email})
|
||||
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ from zerver.lib.exceptions import (
|
||||
from zerver.lib.response import json_success
|
||||
from zerver.lib.subdomains import get_subdomain
|
||||
from zerver.lib.typed_endpoint import typed_endpoint
|
||||
from zerver.lib.users import get_api_key
|
||||
from zerver.lib.validator import validate_login_email
|
||||
from zerver.models import Realm, UserProfile
|
||||
from zerver.models.realms import get_realm
|
||||
@@ -139,7 +138,7 @@ def api_dev_fetch_api_key(request: HttpRequest, *, username: str) -> HttpRespons
|
||||
assert isinstance(user_profile, UserProfile)
|
||||
|
||||
do_login(request, user_profile)
|
||||
api_key = get_api_key(user_profile)
|
||||
api_key = user_profile.api_key
|
||||
return json_success(
|
||||
request,
|
||||
data={"api_key": api_key, "email": user_profile.delivery_email, "user_id": user_profile.id},
|
||||
|
||||
@@ -79,7 +79,6 @@ from zerver.lib.users import (
|
||||
check_valid_bot_config,
|
||||
check_valid_bot_type,
|
||||
check_valid_interface_type,
|
||||
get_api_key,
|
||||
get_users_for_api,
|
||||
max_message_id_for_user,
|
||||
validate_user_custom_profile_data,
|
||||
@@ -678,7 +677,7 @@ def add_bot_backend(
|
||||
|
||||
notify_created_bot(bot_profile)
|
||||
|
||||
api_key = get_api_key(bot_profile)
|
||||
api_key = bot_profile.api_key
|
||||
|
||||
json_result = dict(
|
||||
user_id=bot_profile.id,
|
||||
@@ -706,7 +705,7 @@ def get_bots_backend(request: HttpRequest, user_profile: UserProfile) -> HttpRes
|
||||
# Bots are supposed to have only one API key, at least for now.
|
||||
# Therefore we can safely assume that one and only valid API key will be
|
||||
# the first one.
|
||||
api_key = get_api_key(bot_profile)
|
||||
api_key = bot_profile.api_key
|
||||
|
||||
return dict(
|
||||
username=bot_profile.email,
|
||||
|
||||
@@ -16,7 +16,6 @@ from zerver.lib.exceptions import JsonableError
|
||||
from zerver.lib.pysa import mark_sanitized
|
||||
from zerver.lib.response import json_success
|
||||
from zerver.lib.typed_endpoint import typed_endpoint
|
||||
from zerver.lib.users import get_api_key
|
||||
from zerver.models import UserProfile
|
||||
|
||||
# Hack for mit.edu users whose Kerberos usernames don't match what they zephyr
|
||||
@@ -63,7 +62,7 @@ def webathena_kerberos_login(
|
||||
|
||||
# TODO: Send these data via (say) RabbitMQ
|
||||
try:
|
||||
api_key = get_api_key(user_profile)
|
||||
api_key = user_profile.api_key
|
||||
command = [
|
||||
"/home/zulip/python-zulip-api/zulip/integrations/zephyr/process_ccache",
|
||||
user,
|
||||
|
||||
Reference in New Issue
Block a user