From 3ed2a30e01c48487563223a668d43ea42611dd24 Mon Sep 17 00:00:00 2001 From: Mateusz Mandera Date: Sun, 12 Mar 2023 20:04:32 +0100 Subject: [PATCH] maybe_send_to_registration: Remove password_required arg. This argument was added with the default incorrectly set to `True` in bb0eb76bf34920f7a7b6e8fe0bc397ceae239ba1 - despite `maybe_send_to_registration` only ever being called in production code in a single place, with `password_required=False` explicitly. And then it just got carried forward through refactors. `maybe_send_to_registration` was/is also called twice in tests, falling back to the default, but the `password_required` value is irrelevant to the tests - and if anything letting it use the `True` has been wrong, due to not matching how this function is actually used. --- zerver/views/auth.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/zerver/views/auth.py b/zerver/views/auth.py index 23e3606ad9..60b167d368 100644 --- a/zerver/views/auth.py +++ b/zerver/views/auth.py @@ -154,7 +154,6 @@ def maybe_send_to_registration( mobile_flow_otp: Optional[str] = None, desktop_flow_otp: Optional[str] = None, is_signup: bool = False, - password_required: bool = True, multiuse_object_key: str = "", full_name_validated: bool = False, ) -> HttpResponse: @@ -241,13 +240,13 @@ def maybe_send_to_registration( except PreregistrationUser.DoesNotExist: existing_prereg_user = None - # password_required and full_name data passed here as argument should take precedence + # full_name data passed here as argument should take precedence # over the defaults with which the existing PreregistrationUser that we've just fetched # was created. prereg_user = create_preregistration_user( email, realm, - password_required=password_required, + password_required=False, full_name=full_name, full_name_validated=full_name_validated, multiuse_invite=multiuse_obj, @@ -316,7 +315,6 @@ def register_remote_user(request: HttpRequest, result: ExternalAuthResult) -> Ht if key not in kwargs_to_pass: kwargs.pop(key, None) - kwargs["password_required"] = False return maybe_send_to_registration(request, **kwargs)