We use email addresses as our usernames and military email addresses (some.name@domain.mil) are returning message "The username is not a valid authentication ID."

We tested this code from the user.module:
if (strpos($name, '@') !== FALSE && !eregi('@([0-9a-z](-?[0-9a-z])*.)+[a-z]{2}([zmuvtg]|fo|me)?$', $name)) return t('The username is not a valid authentication ID.');

and found that if we added an l to [zmuvtg] then it would return true.

Can this code be fixed to accept military email addresses as username?

Comments

mikey_p’s picture

Since this isn't the actually email address, but the username, I'm not sure why we have regex in there to check against common email formats? If we do, why don't we just use valid_email_address()?

csc4’s picture

I have a similar problem and thought that I could solve it by allowing the @ in access rules - but there seems no connection between the access rules allowed patterns and the check - so it still throws an error regardless? Is that correct?

drfuzetto’s picture

I get the error message anytime I try to register with an email address that contains .mil.

Did you solve your problem? If so, how?

tfleming’s picture

We were having the same problem, and - despite not being a Drupal programmer - I knew enough to track down the file mentioned above in our file manager and add the lower-case L where indicated, and it worked.

But as a old-school HTML programmer and current social media manager, I have to ask user.module creators -- how did this very basic oversight occur? Why in the world would .mil addresses not have been standard programming?

sbandyopadhyay’s picture

Version: 6.13 » 6.x-dev
Status: Active » Closed (duplicate)

This issue gets fixed by the patch in #266488: Cleanup for user_validate_name() + tests, so I'm marking it as a duplicate.