<%@ Control Language="VB" AutoEventWireup="false" CodeFile="RetrieveUsernameStep4.ascx.vb" Inherits="Controls_RetrieveUsernameStep4" %>

<div style="padding-left:10px">
    <div align="center">
	    <table border="0">
		    <tr>
			    <td colspan="3" align="left">
				 
			    </td>
		    </tr>
		    <tr>
			    <td align="right">
                    <font color="red">*</font>Username&nbsp;&nbsp;
                </td>
			    <td align="left">
                    <asp:Label runat="server" ID="lblUserName"></asp:Label>
                </td>
			    <td>
                </td>
		    </tr>	
		    <tr>
                <td colspan="3">
                    <br />
                </td>
            </tr>
		    <tr>
			    <td align="right" valign="bottom">
                    <font color="red">*</font>Password&nbsp;&nbsp;
                </td>
			    <td align="left">
                    <asp:TextBox ID="txtCurrPassword" runat="server" TextMode="Password" MaxLength="20" TabIndex="10000" onBlur="blurred(this)" />&nbsp;&nbsp;
			    </td>
		    </tr>
		    <tr>
                <td colspan="2" align="center" style="font-weight:bold;">
                   <span style="text-decoration: line-through">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
                   &nbsp;&nbsp;or&nbsp;&nbsp;
                   <span style="text-decoration: line-through">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
                </td>
            </tr>
		    <tr>
			    <td align="right" valign="bottom">
                    <font color="red">*</font>New Password&nbsp;&nbsp;
                </td>
			    <td align="left">
                    <asp:TextBox ID="txtPassword" runat="server" 
                        TextMode="Password" Style="padding-left: 1px" TabIndex="10000"  
                        MaxLength="20" />&nbsp;&nbsp;
			    </td>
		    </tr>
		    <tr>
                <td colspan="3">
                    <br />
                </td>
            </tr>
		    <tr>
			    <td align="right" valign="bottom">
                    <font color="red">*</font>Confirm Password&nbsp;&nbsp;
                </td>
			    <td align="left">
                    <asp:TextBox ID="txtConfirmPwd" runat="server" 
                        TextMode="Password" Style="padding-left: 1px" TabIndex="10001"  
                        MaxLength="20" />
			    </td>
			    <td>			    
			    </td>			
		    </tr>
		    <tr>
			    <td colspan="3">
				    <asp:RegularExpressionValidator runat="server"
                         ID="revLength" ControlToValidate="txtPassword" 
                         Display="Dynamic" ErrorMessage="Password Required. 8-20 characters in length." 
                         ForeColor="Red" ValidationGroup="Step4" 
                         ValidationExpression=".{8,20}"/>

				    <asp:RegularExpressionValidator runat="server" ID="revNumber" 
                        ControlToValidate="txtPassword" Display="Dynamic" ForeColor="Red" 
                        Text="Password must contain at least one number." 
                        ValidationExpression=".*[0-9]+.*" 
                        ValidationGroup="Step4"/>

				    <asp:RegularExpressionValidator runat="server" ID="revUppercase" 
                        ControlToValidate="txtPassword" Display="Dynamic" ForeColor="Red" 
                        Text="Password must contain at least one uppercase letter." 
                        ValidationExpression=".*[A-Z]+.*" 
                        ValidationGroup="Step4"/>

				    <asp:RegularExpressionValidator runat="server" ID="revLowercase" 
                        ControlToValidate="txtPassword" Display="Dynamic" 
                        ForeColor="Red" Text="Password must contain at least one lowercase letter." 
                        ValidationExpression=".*[a-z]+.*" 
                        ValidationGroup="Step4"/>
    <%-- 

    Special character requirement not mandatory, but if it's there, don't allow a \ or ".
    Initially developed list of valid characters regex expression: ".*[!@#$%^&*()\-_=+`~\[\]{}?|]+.*" 
    It's easier to maintain and read if we use a negative-case matching expression.
    This expression ^(?=[^\\"]*$) when tested on www.regexlib.com satisfies the requirement of matching any string that does NOT contain a \ or a ".  But when I put it into validator below it was failing.  I changed the Engine on the site to use client-side valiation and then came up with this expression: ^[^\\"]*$ This works both in testing and when used in validator below.
    --%>
				    <asp:RegularExpressionValidator runat="server" ID="revSpecialCharacter" 
                        ControlToValidate="txtPassword" Display="Dynamic" ForeColor="Red" 
                        Text="Password can not contain quotes or backslash." 
                        ValidationExpression='^[^\\"]*$' ValidationGroup="Step4"/>
				
				    <%--
				    'JPIRKEY Examples of valid passwords are: abc123DEF! | p2sSw@rd | p2sSw@rd#l0ngEr | abc#$%GH1. 
				    'INVALID Passwords: p2ssw@rd | p2sSw@rd#l0ngErThisIs2l0ng | abc123DEF
				    'The expression below works in IE8 and FF3, but not in IE7.  The expression was broken out into separate pieces to attempt
				    'to correct this browser issue.
				    <asp:RegularExpressionValidator ID="revPassword" runat="server" ControlToValidate="txtPassword" ErrorMessage="Password must be between 8 and 20 characters, contain at least 1 number, 1 lowercase letter, 1 uppercase letter and one special character." Display="Dynamic" ForeColor="Red" ValidationExpression="^(?=.*[!@#$%^&*()\-_=+`~\[\]{}?|])(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9]).{8,20}$"  ValidationGroup="Step4"></asp:RegularExpressionValidator> 
				    --%>
				    <asp:RequiredFieldValidator runat="server" ID="rfvConfirmPassword" 
                        ControlToValidate="txtConfirmPwd" Display="Dynamic" ForeColor="Red" 
                        ErrorMessage="You must re-type and confirm your new password." 
                        SetFocusOnError="true" ValidationGroup="Step4"/>
				    <asp:CompareValidator runat="server" ID="cfvPassword" 
                        ControlToCompare="txtPassword" ControlToValidate="txtConfirmPwd" 
                        Display="Dynamic" Text="Passwords do not match" 
                        ForeColor="Red"  ValidationGroup="Step4"/>
			    </td>
		    </tr>
	    </table>
    </div>
</div>