ldap login works, refactored