<%@ Page Language="vb" MasterPageFile="~/CITAD.Master" 
    AutoEventWireup="false" 
    CodeBehind="ChangePass.aspx.vb" 
    Inherits="CITAD.WEB.VB.ChangePass"
    Title="Thay đổi mật khẩu" 
    meta:resourcekey="PageResource1" 
    Culture="auto" UICulture="auto" %>

<%@ Register Src="../../Controls/MessageBox.ascx" TagName="MessageBox" TagPrefix="uc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div style="text-align:center;">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
        <fieldset style="padding-top:30px;padding-left:100px;padding-right:100px;">
    <table style="text-align:left;" >
        <tr>
            <td align="right">
                <asp:Label ID="lblPassword" runat="server" Text="Mật khẩu" meta:resourcekey="lblPasswordResource1"></asp:Label></td>
            <td style="width: 100px">
                <asp:TextBox ID="txtPassword" runat="server" CssClass="citad-txt" TextMode="Password" meta:resourcekey="txtPasswordResource1" MaxLength="30"></asp:TextBox></td>
            <td align="left">
                <asp:RequiredFieldValidator ID="rfvTextPass" runat="server" ControlToValidate="txtPassword"
                    ErrorMessage="Mật khẩu không được để trống" ValidationGroup="ChangePass" Display="Dynamic" SetFocusOnError="True" meta:resourcekey="rfvTextPassResource1"></asp:RequiredFieldValidator></td>
            <td align="left">
                <asp:CustomValidator ID="ctvPassword" runat="server" ClientValidationFunction="fcnValidLength_Password"
                    ControlToValidate="txtPassword" Display="Dynamic" ErrorMessage="Mật khẩu phải lớn hơn hoặc bằng 6 ký tự" ValidationGroup="ChangePass" meta:resourcekey="ctvPasswordResource1"></asp:CustomValidator></td>
            <td>
            </td>
        </tr>
        <tr>
            <td align="right">
                <asp:Label ID="lblPassNew" runat="server" Text="Mật khẩu mới" meta:resourcekey="lblPassNewResource1"></asp:Label></td>
            <td style="width: 100px">
                <asp:TextBox ID="txtPassNew" runat="server" CssClass="citad-txt" TextMode="Password" meta:resourcekey="txtPassNewResource1" MaxLength="30"></asp:TextBox></td>
            <td  align="left">
                <asp:RequiredFieldValidator ID="rfvTextPassNew" runat="server" ErrorMessage="Mật khẩu mới không được để trống"
                    ValidationGroup="ChangePass" Display="Dynamic" SetFocusOnError="True" ControlToValidate="txtPassNew" meta:resourcekey="rfvTextPassNewResource1"></asp:RequiredFieldValidator></td>
            <td align="left">
                <asp:CustomValidator ID="ctvPassNew" runat="server" ClientValidationFunction="fcnValidLength_PassNew"
                    ControlToValidate="txtPassNew" Display="Dynamic" ErrorMessage="Mật khẩu mới phải lớn hơn hoặc bằng 6 ký tự"
                    ValidationGroup="ChangePass" meta:resourcekey="ctvPassNewResource1"></asp:CustomValidator></td>
            <td>
            </td>
        </tr>
        <tr>
            <td align="right">
                <asp:Label ID="lblPassNewReInput" runat="server" Text="Nhập lại mật khẩu" meta:resourcekey="lblPassNewReInputResource1"></asp:Label></td>
            <td style="width: 100px">
                <asp:TextBox ID="txtPassNewReInput" runat="server" CssClass="citad-txt" TextMode="Password" meta:resourcekey="txtPassNewReInputResource1" MaxLength="30"></asp:TextBox></td>
            <td  align="left">
                <asp:RequiredFieldValidator ID="rfvTextPassNewReInput" runat="server" ErrorMessage="Phải nhập lại mật khẩu mới"
                    ValidationGroup="ChangePass" Display="Dynamic" Height="20px" SetFocusOnError="True" ControlToValidate="txtPassNewReInput" meta:resourcekey="rfvTextPassNewReInputResource1"></asp:RequiredFieldValidator></td>
            <td align="left">
                <asp:CompareValidator ID="cpvPassNew" runat="server" ControlToCompare="txtPassNew"
                    ControlToValidate="txtPassNewReInput" ErrorMessage="Mật khẩu nhập lại không đúng"
                    ValidationGroup="ChangePass" Display="Dynamic" SetFocusOnError="True" meta:resourcekey="cpvPassNewResource1"></asp:CompareValidator></td>
            <td align="left">
                <asp:CustomValidator ID="ctvPassNewReInput" runat="server" ClientValidationFunction="fcnValidLength_PassNewReInput"
                    ControlToValidate="txtPassNewReInput" Display="Dynamic" ErrorMessage="Mật khẩu nhập lại phải lớn hơn hoặc bằng 6 ký tự"
                    ValidationGroup="ChangePass" meta:resourcekey="ctvPassNewReInputResource1"></asp:CustomValidator></td>
        </tr>
        <tr>
            <td align="center" colspan="5">
                <asp:Button ID="btnSave" runat="server" CssClass="citad-btn" Text="Ghi" ValidationGroup="ChangePass" meta:resourcekey="btnSaveResource1" />
                <asp:Button ID="btnClose" runat="server" CssClass="citad-btn" Text="Đóng" meta:resourcekey="btnCloseResource1" /></td>
        </tr>
    </table>
    </fieldset>
    <uc1:MessageBox ID="MessageBox1" runat="server" />
        </ContentTemplate>
    </asp:UpdatePanel>
</div>
    <script language="javascript" type="text/javascript">
        function fcnValidLength_Password(source, clientside_arguments)
        {
            if(document.getElementById('<%=txtPassword.ClientID %>').value.trim().length < 6)
            {
                clientside_arguments.IsValid = false;
                document.getElementById('<%=txtPassword.ClientID %>').focus();
            }
        }
        function fcnValidLength_PassNew(source, clientside_arguments)
        {
            if(document.getElementById('<%=txtPassNew.ClientID %>').value.trim().length < 6)
            {
                clientside_arguments.IsValid = false;
                document.getElementById('<%=txtPassNew.ClientID %>').focus();
            }
        }
        function fcnValidLength_PassNewReInput(source, clientside_arguments)
        {
            if(document.getElementById('<%=txtPassNewReInput.ClientID %>').value.trim().length < 6)
            {
                clientside_arguments.IsValid = false;
                document.getElementById('<%=txtPassNewReInput.ClientID %>').focus();
            }
        }
    </script>

</asp:Content>