Glasses on top of laptop keyboard

Using email addresses as your Sitecore username

Are you storing extranet users in the Sitecore database? Want the user to sign in with their email address to easily remember their username? By default, Sitecore doesn’t allow email address formats to be stored in the username field, but never fear, it can be done!

The Sitecore setting ‘AccountNameValidation‘ sets a regular expression that gets used to validate whether a provided username has a valid format. You can find more details on this setting via the Sitecore KB article: https://kb.sitecore.net/articles/259229

Note: I recommend using a patch configuration to change this value, as opposed to editing the Web.config as recommended by the KB article.

An easy regex that will let anything in is the following:

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

You will likely also want to consider enforcing unique usernames on your membership provider. The requiresUniqueEmail attribute on your membership provider can be set to true. See Brian Caos blog for more details!

Uhhh… this post seems a LOT like Brian’s blog

Yup! Kudos to Brian for the great post. I’ll admit, this one is mostly for me to be able to quickly find the details next time I need it 🙂

Advertisements

2 thoughts on “Using email addresses as your Sitecore username”

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s