<%-- 
    Document   : ChangePassword_fflag
    Created on : Aug 3, 2021, 6:02:29 PM
    Author     : 1242938
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>

<html>
    <head>
        <title>Change Password</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <script src="${pageContext.request.contextPath}/js/Calendar.js?pacs=<%=((new java.util.Date()).getTime())%>"></script>
        <link rel="stylesheet" type="text/css" href="/PacsApplication/css/TableCSSCode.css?pacs=<%=((new java.util.Date()).getTime())%>" />
        <link rel="shortcut icon" href="${pageContext.request.contextPath}/img/favicon.ico?pacs=<%=((new java.util.Date()).getTime())%>" type="image/x-icon" />
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" type="text/css" href="/PacsApplication/css/styles.css?pacs=<%=((new java.util.Date()).getTime())%>"/>
        <link rel="stylesheet" type="text/css" href="/PacsApplication/css/ButtonAndText.css?pacs=<%=((new java.util.Date()).getTime())%>" />
        <link rel="stylesheet" type="text/css" href="/PacsApplication/css/info.css?pacs=<%=((new java.util.Date()).getTime())%>" />
        <script type="text/javascript" src="${pageContext.request.contextPath}/jquery-ui-1.10.4.custom/development-bundle/jquery-1.10.2.js?pacs=<%=((new java.util.Date()).getTime())%>"></script>
        <script type="text/javascript" src="/PacsApplication/chromejs/chrome.js?pacs=<%=((new java.util.Date()).getTime())%>"></script>
        <script type="text/javascript" src="/PacsApplication/js/iFrame_killer.js"></script>
         <%
             String error_msg = "*This page will automatically redirect you to the Login page on successfull change of password.";
             Object error = request.getAttribute("error");
             if (error != null) {
                 error_msg = error.toString();%>
                
            <% }
           
        %>

        <script type="text/javascript">
            function passwordCheck(changePassword)
            {
                if(document.getElementById("newPass").value!=undefined && document.getElementById("newPass").value!="" && document.getElementById("conNewPass").value!=undefined && document.getElementById("conNewPass").value!=""){
                var newPass=document.getElementById("newPass").value;
                var conNewPass=document.getElementById("conNewPass").value;
               
                if(!CheckPassword(newPass))
                    {
                        alert('Password should contain at least one lowercase letter, one uppercase letter, one numeric digit and one special character and min of 8 character length.');
                        document.getElementById("newPass").focus();
                        return false;
                    }
                if(newPass==conNewPass)
                {
                    document.forms[0].action='/PacsApplication/ChangeUserPasswordServlet_fflag';
                    changePassword.submit();
                   
                }
                else
                {
                    alert('Passwords does not match');
                    document.getElementById("newPass").focus();
                    return false;
                }
            }
            else
                {
                    if (document.getElementById("newPass").value=="") {
                        alert('New Password can not be blank.');
                        document.getElementById("newPass").focus();
                        return false;
                    }
                    else {
                        alert('Confirm New Password can not be blank.');
                        document.getElementById("conNewPass").focus();
                        return false;
                    }
                }
            }

    function CheckPassword(inputtxt)
    {
        var decimal=  /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9])(?!.*\s).{8,30}$/;
        if(inputtxt.match(decimal))
        {
            return true;
        }
        else
        {
            return false;
        }
    }

        </script>
        
    </head>
    <body style="background-image: url('/PacsApplication/img/download.jpg');" onload="noBack();">
        <script type="text/javascript">
            function noBack()
                 {
                    window.history.forward();
                 }
        </script>
        <%
                    String ModuleName = new String();

                    ModuleName = (String) session.getAttribute("moduleName");
                    String role = (String) session.getAttribute("userRole");
                    String pacsId = (String) session.getAttribute("pacsId");
                    
        %>
       
        <br>

        <center>
            <div id="changePwdId" style="display:block;">
            <fieldset style="border-color: black; background-image: url('/PacsApplication/img/download.jpg'); border-width: 3px">
            <div><p><font face="Trebuchet MS" color="#0000FF" size="5">This is either your first login or your password has been expired, please change your password to proceed.</font></p></div>
            <br>
            <form name="changePassword" method="post" action="ChangeUserPasswordServlet">
                <table border="0" cellspacing="1" cellpadding="2">
                    <tbody>
                        
                        <tr>
                            <td align="left">New Password <span><font color="red" >*</font></span>:</td>
                            <td align="left"><input type="password" name="newpass" id="newPass" autocomplete="off" /></td>
                        </tr>
                        <tr>
                            <td align="left">Confirm New Password <span><font color="red" >*</font></span>:</td>
                            <td align="left"><input type="password" name="connewpass" id="conNewPass" autocomplete="off" /></td>
                        </tr>
                        <tr>
                            <td>&nbsp;</td>
                            <td>&nbsp;</td>
                        </tr>
                        <tr>
                            <td colspan="2" align="center">
                                <input type="button" value="Submit" onclick="javascript:passwordCheck(changePassword)"/>
                                <input type="reset" value="Reset" name="reset" />
                            </td>
                        </tr>
                    </tbody>
                </table>
                <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="SlateBlue" ><b><%= error_msg%> </b></font><br>
            </form>
            </fieldset>
           </div>
        </center>
    </body>
</html>
