Replacing invalid characters in LDAP username

Allowing users with blank spaces in LDAP username to login / create a new user.
Trailing whitespace detected.