Use Email Address as Sitecore Account Username

Default sitecore username does not allow special characters like “at (@)”, “dot (.)”. So when try to create an account with email address as username, it will give this error:

user name is not valid in the selected domain

It is because there is a default validation on username with the regular expression “^\w[\w\s]*$”.

To let username be email address, just need to add the following setting in web.config file:

<!-- AccountNameValidation
Overwrite original setting to allow email address as Sitecore username
<setting name="AccountNameValidation" value="^[A-Za-z0-9._%+-]{1,64}@([A-Za-z0-9.-]+\.[A-Za-z]{2,4}){1,255}$" />

Value here is a regular expression for email. Of course there are many other ways of writing it. Or simply, just set value=”.+” to allow all characters.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s