here is my case.
I am using EPiServer 9 and I have configured a SqlServerMembershipProvider as follows:
<add name="SqlServerMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
connectionStringName="EPiServerXYZ"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="false"
requiresUniqueEmail="false"
maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="8"
minRequiredNonalphanumericCharacters="1"
passwordAttemptWindow="10"
applicationName="/"
passwordStrengthRegularExpression="^.*(?=.{8,})(?=.*\d)(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[^\w\d\s]).*$" />
Everything is working fine, the validations and different scenarios.
Our problem is that the error message being displayed by the membership provider is created by using the configuration and it ends up giving not user friendly messages such as:
- 'Invalid password, minimum length: 8, minimum non alphanumeric characters: 1'
- 'Non alpha numeric characters in 'newPassword' needs to be greater than or equal to '1'. Parameter name: newPassword'
- 'The parameter 'newPassword' does not match the regular expression specified in config file. Parameter name: newPassword'
I would love to set a custom error message which really explains to the user all of the requirements we have in the regular expression which is used to validate the password.
The only way I can think about doing this so far is by implementing/extending the current provider we are using just to set a custom error message when something goes wrong with the validation but I guess there might be another better/simpler way of doing this.
Thanks in advance!