Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
1.3 kB
4
Indexable
Never
          PASSWORD VALIDATION 2





<html>
    <head>
        <title>pswd validation</title>
    </head>
    <body>
        <form onsubmit = "return verifyPassword()">
            enter the password: <input type="password" id="pwd" name ="pwd">
            <input type="submit" value="Submit">
        </form>
        <script type = "text/javascript">
        function verifyPassword() 
        {
            var pw = document.getElementById("pwd").value;
            if(pw.search(/[A-Z]/) < 0)
            {
                alert("minimum one uppercase");
                return false;
            }
            if(pw.search(/[0-9]/) < 0)
            {
                alert("minimum one number");
                return false;
            }
            if(pw.search(/[# *]/) < 0)
            {
                alert("minimum one # or * symbol");
                return false;
            }
            if(pw.length < 8)
            {
                 alert("minimum 8 character");
                 return false;
            }
            if(pw.length > 15)
            {
                alert("maximum 15 character");
                return false;
            }
            else
            {
                alert("Password validation successfull")
            }
        }
        </script>
    </body>
</html>