auth: Check for RemoteUserBackend being enabled earlier.

This is possible now that we have a realm object before fetching the
UserProfile object.
This commit is contained in:
Tim Abbott
2017-11-21 12:04:04 -08:00
parent d63e9f240c
commit 73df431b88

View File

@@ -415,6 +415,8 @@ class ZulipRemoteUserBackend(RemoteUserBackend):
assert remote_user is not None
if realm is None:
return None
if not auth_enabled_helper(["RemoteUser"], realm):
return None
email = remote_user_to_email(remote_user)
user_profile = common_get_active_user_by_email(email)
@@ -422,8 +424,6 @@ class ZulipRemoteUserBackend(RemoteUserBackend):
return None
if not user_matches_subdomain(realm.subdomain, user_profile):
return None
if not auth_enabled_helper(["RemoteUser"], user_profile.realm):
return None
return user_profile
class ZulipLDAPException(_LDAPUser.AuthenticationFailed):