🔐 fix: Handle Multiple Email Addresses in LDAP Auth (#9729)

This commit is contained in:
Thomas Joußen 2025-09-20 17:01:45 +02:00 committed by GitHub
parent 2489670f54
commit a5195a57a4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 188 additions and 1 deletions

View file

@ -109,7 +109,8 @@ const ldapLogin = new LdapStrategy(ldapOptions, async (userinfo, done) => {
const username =
(LDAP_USERNAME && userinfo[LDAP_USERNAME]) || userinfo.givenName || userinfo.mail;
const mail = (LDAP_EMAIL && userinfo[LDAP_EMAIL]) || userinfo.mail || username + '@ldap.local';
let mail = (LDAP_EMAIL && userinfo[LDAP_EMAIL]) || userinfo.mail || username + '@ldap.local';
mail = Array.isArray(mail) ? mail[0] : mail;
if (!userinfo.mail && !(LDAP_EMAIL && userinfo[LDAP_EMAIL])) {
logger.warn(