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:
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 🙂
Hi Jason, you could also let the email at the Email field, which is not custom, then get the user by it. Like: System.Web.Security.Membership.GetUserNameByEmail
See, err…. this John West’s post:
Thanks Rodrigo! That’s a good one I didn’t know about.