requarks / wiki-v1

Legacy version (1.x) of Wiki.js
https://wiki.js.org
GNU Affero General Public License v3.0
101 stars 75 forks source link

LDAP Authentication won't work when user has multiple e-mails #159

Open baldpale opened 5 years ago

baldpale commented 5 years ago

Actual behavior

Can't login when user have multiple e-mail addresses - login screen says "Invalid User Email"

Expected behavior

When there are multiple e-mail addresses in LDAP, first one should be taken by default. Alternatively, there should be option to specify which field should be used as e-mail addresses (e.g our AD has custom field with preferred e-mail).

Steps to reproduce the behavior

Possible resolution

In server/libs/auth.js in LDAP section I added

if (Array.isArray(profile.mail)) {
    profile.mail = profile.mail.shift()
}

Works as expected.