.Net Change Password control customisation - password validation
Posted on 2008-11-20
I am creating a change password page on a new site using the Change Password control from .Net
Site will be based on 3.5 Framework
so i have this basically:
<asp:ChangePassword ID="ChangePassword1" runat="server" MembershipProvider="AspNetSqlMembershipProvider"></asp:ChangePassword>
I would like to do the following server side:
I need to first check the username and based on the username apply only one of the following validation rules:
If User is Admin - Ensure Password is 11 characters long
If user is Normal Member - Ensure password is 10 characters long
For BOTH of these there are also extra validation rules:
- Must use at least 3 of the following characters (lowercase, uppercase, numerals, special symbols)
How i determine a user is Admin or Normal Member will depend on the username, logic yet to be finalised but for purpose of this excerise lets assume admins have "adm" infront of their username, normal members dont
Can anyone help me with how i would do the validation checking as detailed above?
I would prefer to use regular exp for the password validation to make the code easier to update later on.
I have never used this control before so unsure of what event to perform such validation on to ensure the password is not changed unless these rules are checked for.
Lots of points on offer for complete answer.