1638 fix ldap multi valued email attribute

Fix multi-valued email attributes in LDAP
 - properly handle multi-valued attributes in LDAP
 - look for an` existing user having one of the emails from LDAP otherwise take
   the first lexicographically sorted email for the new user
 - fix #1638