OPNsense Forum

Archive => 18.1 Legacy Series => Topic started by: nantoine555 on March 05, 2018, 11:55:19 am

Title: Edit LDAP Users: "The username contains invalid characters" when using an AD UPN
Post by: nantoine555 on March 05, 2018, 11:55:19 am
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
Title: Re: Edit LDAP Users: "The username contains invalid characters" when using an AD UPN
Post by: nantoine555 on March 05, 2018, 02:32:54 pm
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.");
        }
Title: Re: Edit LDAP Users: "The username contains invalid characters" when using an AD UPN
Post by: franco on March 06, 2018, 01:03:49 pm
Likely solved via https://github.com/opnsense/core/issues/2242
Title: Re: Edit LDAP Users: "The username contains invalid characters" when using an AD UPN
Post by: nantoine555 on March 06, 2018, 07:30:50 pm
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