In my register view, I have:
<div>
@Html.ValidationMessageFor(m => m.Password)
</div>
If I use a password like foobar100 the validation fails however the error message doesn’t provide a proper reason why it failed. I.e. The password provided is invalid. Please enter a valid password value. It will only work if I do something like foob@r100.
Is there a way to reduce the strictness of the validation rules? Or at least change the validation error message?
Update
The data validation attributes on the object I am checking are:
[Required]
[StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
[DataType(DataType.Password)]
[Display(Name = "Password")]
public string Password { get; set; }
which say nothing about requiring an @ symbol.
To reduce the validation strictness. E.g. not have the need for alphanumeric characters. You need to alter the
MembershipProviderproperties. This can be done via theweb.configfile as per http://msdn.microsoft.com/en-us/library/system.web.security.membershipprovider.minrequirednonalphanumericcharacters.aspx.You can then better control the level of strictness via Danny Tuppeny’s answer.