From 5fbb8b62041bebac9b8317463b56b674dee331f1 Mon Sep 17 00:00:00 2001 From: Yogesh Mahajan Date: Tue, 27 Sep 2022 15:38:48 +0530 Subject: [PATCH] Fixed error occurring while LDAP authentication for a user with multiple email attributes. #5352 --- docs/en_US/release_notes_6_15.rst | 1 + web/pgadmin/authenticate/ldap.py | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/en_US/release_notes_6_15.rst b/docs/en_US/release_notes_6_15.rst index 37185f3ba..1d3332f00 100644 --- a/docs/en_US/release_notes_6_15.rst +++ b/docs/en_US/release_notes_6_15.rst @@ -35,4 +35,5 @@ Bug fixes | `Issue #5262 `_ - Ensure that the user management dialog should not allow the same email addresses with different letter casings when creating users. | `Issue #5308 `_ - Ensure that the default value for a column should be used if it is made empty. | `Issue #5338 `_ - Fixed an issue where the prompt is not visible when clicking on the 'save results to file' button on the large data. + | `Issue #5352 `_ - Fixed error occurring while LDAP authentication for a user with multiple email attributes. | `Issue #5368 `_ - Fixed the issue while downloading the file from the file manager. diff --git a/web/pgadmin/authenticate/ldap.py b/web/pgadmin/authenticate/ldap.py index 2c022caef..8c8825f26 100644 --- a/web/pgadmin/authenticate/ldap.py +++ b/web/pgadmin/authenticate/ldap.py @@ -97,7 +97,11 @@ class LDAPAuthentication(BaseAuthentication): return status, msg if 'mail' in ldap_user: - user_email = ldap_user['mail'].value + mail = ldap_user['mail'].value + if isinstance(mail, list) and len(mail) > 0: + user_email = mail[0] + else: + user_email = ldap_user['mail'].value return self.__auto_create_user(user_email)