mirror of https://github.com/zulip/zulip.git
register_remote_user: Use explicit kwargs list.
This is nicer that .pop()ing specified keys - e.g. we no longer will have to update this chunk of code whenever adding a new key to ExternalAuthDataDict.
This commit is contained in:
parent
90cc2716f0
commit
af9d1a7dfb
|
@ -300,9 +300,21 @@ def register_remote_user(request: HttpRequest, result: ExternalAuthResult) -> Ht
|
||||||
# the request to registration.
|
# the request to registration.
|
||||||
kwargs: Dict[str, Any] = dict(result.data_dict)
|
kwargs: Dict[str, Any] = dict(result.data_dict)
|
||||||
# maybe_send_to_registration doesn't take these arguments, so delete them.
|
# maybe_send_to_registration doesn't take these arguments, so delete them.
|
||||||
kwargs.pop("subdomain", None)
|
|
||||||
kwargs.pop("redirect_to", None)
|
# These are the kwargs taken by maybe_send_to_registration. Remove anything
|
||||||
kwargs.pop("is_realm_creation", None)
|
# else from the dict.
|
||||||
|
kwargs_to_pass = [
|
||||||
|
"email",
|
||||||
|
"full_name",
|
||||||
|
"mobile_flow_otp",
|
||||||
|
"desktop_flow_otp",
|
||||||
|
"is_signup",
|
||||||
|
"multiuse_object_key",
|
||||||
|
"full_name_validated",
|
||||||
|
]
|
||||||
|
for key in dict(kwargs):
|
||||||
|
if key not in kwargs_to_pass:
|
||||||
|
kwargs.pop(key, None)
|
||||||
|
|
||||||
kwargs["password_required"] = False
|
kwargs["password_required"] = False
|
||||||
return maybe_send_to_registration(request, **kwargs)
|
return maybe_send_to_registration(request, **kwargs)
|
||||||
|
|
Loading…
Reference in New Issue