Quantcast
Viewing all articles
Browse latest Browse all 275

Sitecore allow email adress as user name

If you try to create a new user in Sitecore with an email address as account name you will be met with a validation error:

“user name is not valid in the selected domain.”

But do not worry, it’s not the underlying security framework that disallows email as username, it’s just a default validation of user names in the user manager dialog box.

The default validation is based on this regular expression: ^\w[\w\s]*$

You can change the regular expression using the AccountNameValidation setting. Add the following to your web.config:

<setting name="AccountNameValidation" value=".+" />

When using the users email address as username, you should consider changing the membership provider in Sitecore to require a unique email. Otherwise you risk having users that share email addresses.

The change is simple. Go to web.config and change the attribute “requiresUniqueEmail” to “true“:

<add name="sql"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="core"
applicationName="sitecore"
minRequiredPasswordLength="1"
minRequiredNonalphanumericCharacters="0"
requiresQuestionAndAnswer="false"
requiresUniqueEmail="true"
maxInvalidPasswordAttempts="256" />

 


Image may be NSFW.
Clik here to view.
Image may be NSFW.
Clik here to view.

Viewing all articles
Browse latest Browse all 275

Trending Articles