CreateUserWizard password error

Jul 30, 2007 at 8:54 AM
I modified the CreateUserWizard password errore generation from

case MembershipCreateStatus.InvalidPassword:
_currentErrorText = wizard.InvalidPasswordErrorMessage;


_currentErrorText = String.Format(wizard.InvalidPasswordErrorMessage,
Membership.MinRequiredPasswordLength, Membership.MinRequiredNonAlphanumericCharacters);

Is it correct?
Jul 31, 2007 at 2:15 PM
It may be fine for your specific implementation, but considering the MinRequiredPasswordLength and MinRequiredNonAlphanumericCharacters aren't necessarily "required" it wouldn't be feasible to add such a change to a general-use code base -- especially considering the default value is "Please enter a valid password.".
Jul 31, 2007 at 2:39 PM
I'm a no-expert: which should be the "best" way to implement that for all the users?

It could check if they are set, and in this case, modify the message accordingly?

I'm posting this since, if you set those two fields, the error message requires {0} and {1} to be MinRequiredPasswordLength and MinRequiredNonAlphanumericCharacters, and if you don't provide them, the message is not well formatted.

In my proposal, if the error message isn't requiring those two fields, it should be expanded as the default one (ignoring the extra fields).