Edit LDAP Users: "The username contains invalid characters" when using an AD UPN

Started by nantoine555, March 05, 2018, 11:55:19 AM

Previous topic - Next topic
Hello,

We are importing users from an Active Directory.

In the LDAP configuration, the User naming attribute is userPrincipalName, so the Usernames are in UPN form (user@domain.com).

First import from LDAP is fine, but we are unable to edit and save users:
"The username contains invalid characters"

I think it is only a html form validation issue, but are any other issues when a username contains "@" and "." characters?

Thanks, and keep doing such a fine job :)

Antoine

Ok, opening an issue on github, found the following code:

        if (preg_match("/[^a-zA-Z0-9\.\-_]/", $pconfig['usernamefld'])) {
            $input_errors[] = gettext("The username contains invalid characters.");
        }
        if (strlen($pconfig['usernamefld']) > 32) {
            $input_errors[] = gettext("The username is longer than 32 characters.");
        }


I'll just have to explain to my users that they'll have to enter their windows account and not their email when login to the vpn ;D