<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Update.aspx.cs" Inherits="Cybersecurity.Update" %>


<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>CyberSecurity</title>
    <link href="Content/bootstrap.min.css" rel="stylesheet"/>
    <script src="Scripts/jquery-3.0.0.min.js"></script>
    <script src="Scripts/bootstrap.min.js"></script>
</head>
<body>
    <form id="form2" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager>
        <div>
            <h2>Password Update Form</h2>
            <br />

            <div class="form-group">                
                
                <div class="form-group row">
                    <label for="txtEmail" class="col-sm-1 col-form-label">Email:</label>
                    
                    <div class="col-sm-2">
                        <asp:TextBox ID="txtEmail" class="form-control" runat="server"></asp:TextBox>
                    </div>
                    <div class="col-sm-4">
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtEmail" ErrorMessage="Please Enter Your Email" Display="Dynamic" ForeColor="Red"></asp:RequiredFieldValidator>
                        <asp:RegularExpressionValidator ID="regexEmailValid" runat="server" ClientValidationFunction="changeColor" ControlToValidate="txtEmail" ErrorMessage="Invalid Email Format" 
                            Display="Dynamic" ForeColor="Red" ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
                    </div>
                </div>

                <div class="form-group row">
                    <label for="txtCurrentPassword" class="col-sm-1 col-form-label">Current Password:</label>
                    
                    <div class="col-sm-2">
                        <asp:TextBox ID="txtCurrentPassword" class="form-control" runat="server" TextMode="Password"></asp:TextBox>
                    </div>
                    <div class="col-sm-4">
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtCurrentPassword" ErrorMessage="Please Enter Your Password" ForeColor="Red"></asp:RequiredFieldValidator>                       
                    </div>
                </div>


                <div class="form-group row">
                    <label for="txtNewPassword" class="col-sm-1 col-form-label">New Password:</label>
                    
                    <div class="col-sm-2">
                        <asp:TextBox ID="txtNewPassword" class="form-control" runat="server" TextMode="Password"></asp:TextBox>
                    </div>
                    <div class="col-sm-4">
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtNewPassword" ErrorMessage="Please Enter Your Password" ForeColor="Red"></asp:RequiredFieldValidator>
                        <asp:RegularExpressionValidator ID="regexPasswordValid" runat="server" ValidationExpression="^.*(?=.{6,})(?=.*[\d])(?=.*[a-z])(?=.*[A-Z])(?=.*[\W]).*$"
                        ClientValidationFunction="changeColor" ForeColor="Red" ControlToValidate="txtNewPassword" Display="Dynamic"
                        ErrorMessage="Include uppercase and lowercase letters, numeric and symbol characters, and be at least 6 in length"></asp:RegularExpressionValidator>
                        <asp:CompareValidator ID="CompareValidator1" runat="server" ClientValidationFunction="changeColor" ControlToCompare="txtCurrentPassword" ControlToValidate="txtNewPassword" 
                            Display="Dynamic" Operator="NotEqual" ErrorMessage="Current and New Password won't be same!" ForeColor="Red" />
                        <ajaxToolkit:PasswordStrength ID="txtPassword_PasswordStrength" runat="server" BehaviorID="txtPassword_PasswordStrength" 
                            MinimumLowerCaseCharacters="1" MinimumNumericCharacters="1" MinimumSymbolCharacters="1" MinimumUpperCaseCharacters="1" PreferredPasswordLength="10" TargetControlID="txtNewPassword"
                            TextStrengthDescriptions="Very Poor;Weak;Average;Strong;Excellent" RequiresUpperAndLowerCaseCharacters="true" CalculationWeightings="50;15;15;20" />
                    </div>
                </div>


                <div class="form-group row">
                    <label for="txtConfrim" class="col-sm-1 col-form-label">Comfirm Password:</label>
                    
                    <div class="col-sm-2">
                        <asp:TextBox ID="txtConfrim" class="form-control" runat="server" TextMode="Password"></asp:TextBox>
                    </div>
                    <div class="col-sm-4">
                        <asp:CompareValidator ID="Compare1" runat="server" ClientValidationFunction="changeColor" ControlToCompare="txtConfrim" ControlToValidate="txtNewPassword" 
                            Display="Dynamic" ErrorMessage="Password and Confirmation Password doesn't match" ForeColor="Red" />
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="txtConfrim" ErrorMessage="Please Confirm Your Password" 
                            Display="Dynamic" ForeColor="Red"></asp:RequiredFieldValidator>
                    </div>
                </div>

                
                <div class="form-group row">
                    
                    <div class="col-sm-1 text-center">
                        <asp:Button ID="btnUpdate" class="btn btn-info" runat="server" Text="Update" OnClick="btnUpdate_Click" />
                    </div>
                    <div>
                        <asp:Label ID="lblErrorMessage" runat="server" ForeColor="Red"></asp:Label>
                    </div>
                </div>
            </div>
        </div>
    </form>
</body>
</html>
