mirror of
https://github.com/zulip/zulip.git
synced 2025-11-10 00:46:03 +00:00
LDAP: Restore an except clause and add test to cover it.
Most of the paths leading through this except clause were cut in73e8bba37"ldap auth: Reassure django_auth_ldap". The remaining one had no test coverage -- the case that leads to it had a narrow unit test, but no test had the exception actually propagate here. As a result, the clause was mistakenly cut, in commit8d7f961a6"LDAP: Remove now-impossible except clause.", which could lead to an uncaught exception in production. Restore the except clause, and add a test for it.
This commit is contained in:
@@ -433,10 +433,8 @@ class ZulipLDAPAuthBackend(ZulipLDAPAuthBackendBase):
|
||||
return user_profile
|
||||
except Realm.DoesNotExist:
|
||||
return None
|
||||
# ZulipLDAPException subclasses _LDAPUser.AuthenticationFailed
|
||||
# and thus will automatically be caught and return None via
|
||||
# django-auth-ldap's existing code, so we don't need to catch
|
||||
# them here.
|
||||
except ZulipLDAPException:
|
||||
return None
|
||||
|
||||
def get_or_create_user(self, username, ldap_user):
|
||||
# type: (str, _LDAPUser) -> Tuple[UserProfile, bool]
|
||||
|
||||
Reference in New Issue
Block a user