auth: Remove unnecessary remote_user=None code path.

This code path was only required because we had remote_user set as a
positional argument here, and thus we'd be running this auth backend's
code when actually using another auth backend (due to how Django auth
backends are selected based on argument signature).
This commit is contained in:
Tim Abbott
2017-11-21 12:00:37 -08:00
parent 387c9109ec
commit d63e9f240c
2 changed files with 1 additions and 7 deletions

View File

@@ -1626,11 +1626,6 @@ class TestZulipRemoteUserBackend(ZulipTestCase):
self.assertEqual(result.status_code, 302)
self.assertEqual(get_session_dict_user(self.client.session), user_profile.id)
def test_authenticate_with_missing_user(self):
# type: () -> None
backend = ZulipRemoteUserBackend()
self.assertIs(backend.authenticate(None), None)
def test_login_success_with_sso_append_domain(self):
# type: () -> None
username = 'hamlet'

View File

@@ -412,10 +412,9 @@ class ZulipRemoteUserBackend(RemoteUserBackend):
def authenticate(self, remote_user: Optional[str],
realm: Optional[Realm]=None) -> Optional[UserProfile]:
assert remote_user is not None
if realm is None:
return None
if remote_user is None:
return None
email = remote_user_to_email(remote_user)
user_profile = common_get_active_user_by_email(email)