Email address are a valid format for the name in an htpasswd file and in a user name in Drupa. l use email addresses as the user name in my Drupal installations but they are clean so that someone@null.com becomes someonenullcom in the htpassword file.

The solution is to make line 59 in function preg _htpasswdsync_sanatize_name in HTPasswdSync.module more liberal by changing it to match the line below.

$name = trim(preg_replace('/[^\w\s@\.]/i', '', $name), " \t\n\r");

You will notice I added @ and . to the character set in the regular expression.

Comments

boardcomputer’s picture

Status: Active » Needs work

Hi, thanks for the solution, used it, because our usernames including dots (".") as a standard for naming convention. otherwise this will rename the users for the htaccess authentication. maybe it could be an option to let the users customize this via a form field. At all, from my point of view this needs to be pushed to the produtive code.

Thx and BR!