diff options
author | Christoph (Sheogorath) Kern | 2017-12-12 10:40:14 +0100 |
---|---|---|
committer | GitHub | 2017-12-12 10:40:14 +0100 |
commit | 454e0f8612acc949531d11cccedc52f7a3c50354 (patch) | |
tree | e9c368d4b2c48b713cd61ae04ff68651269e826a /lib/web | |
parent | b840c3fa5769d7cdd000d7d15d25696a404f4207 (diff) | |
parent | 17e3b8b5cdd7286899df0c5a36ec818aee3812ce (diff) |
Merge pull request #650 from LukasKalbertodt/ldap-username-field
Add setting `ldap.usernameField`
Diffstat (limited to 'lib/web')
-rw-r--r-- | lib/web/auth/ldap/index.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/web/auth/ldap/index.js b/lib/web/auth/ldap/index.js index 9a63578a..cc0d29ad 100644 --- a/lib/web/auth/ldap/index.js +++ b/lib/web/auth/ldap/index.js @@ -24,9 +24,15 @@ passport.use(new LDAPStrategy({ } }, function (user, done) { var uuid = user.uidNumber || user.uid || user.sAMAccountName + var username = uuid + + if (config.ldap.usernameField && user[config.ldap.usernameField]) { + username = user[config.ldap.usernameField] + } + var profile = { id: 'LDAP-' + uuid, - username: uuid, + username: username, displayName: user.displayName, emails: user.mail ? [user.mail] : [], avatarUrl: null, |