sdelements / lets-chat-ldap

LDAP plugin for Let's Chat
MIT License
33 stars 12 forks source link

crash if email is empty in LDAP #12

Open lorieri opened 9 years ago

lorieri commented 9 years ago

if the email (mail field) is empty the app crashes

raesene commented 9 years ago

I'm seeing this issue as well. To provide a bit more information. We're using the docker container 0.4.2 and the LDAP directory is Active Directory. Where the users e-mail field is blank, when they try to authenticate the container exits. Docker logs shows the error as

Release 0.4.2

/usr/src/app/node_modules/lets-chat-ldap/lib/auth.js:93
    var email = ldapEmail.toString().split(',')[0];
                         ^
TypeError: Cannot read property 'toString' of undefined
    at Function.Ldap.createLdapUser (/usr/src/app/node_modules/lets-chat-ldap/lib/auth.js:93:26)
    at Query.<anonymous> (/usr/src/app/node_modules/lets-chat-ldap/lib/auth.js:82:18)
    at /usr/src/app/node_modules/mongoose/node_modules/kareem/index.js:177:19
    at /usr/src/app/node_modules/mongoose/node_modules/kareem/index.js:109:16
    at process._tickCallback (node.js:355:11)