auth: Convert DevAuthBackend to use a unique argument pattern.

This helps ensure that we won't accidentally activate this backend on
other code paths.
This commit is contained in:
Tim Abbott
2017-11-21 12:13:46 -08:00
parent f2d3258a56
commit 4968631d1b
4 changed files with 13 additions and 7 deletions

View File

@@ -533,9 +533,10 @@ class ZulipLDAPUserPopulator(ZulipLDAPAuthBackendBase):
class DevAuthBackend(ZulipAuthMixin):
# Allow logging in as any user without a password.
# This is used for convenience when developing Zulip.
def authenticate(self, username: str, realm_subdomain: Optional[str]=None,
def authenticate(self, dev_auth_username: Optional[str]=None, realm_subdomain: Optional[str]=None,
return_data: Optional[Dict[str, Any]]=None) -> Optional[UserProfile]:
user_profile = common_get_active_user_by_email(username, return_data=return_data)
assert dev_auth_username is not None
user_profile = common_get_active_user_by_email(dev_auth_username, return_data=return_data)
if user_profile is None:
return None
if not dev_auth_enabled(user_profile.realm):