Icontem

File: example2.html

Recommend this page to a friend!
  Classes of Axel Hahn  >  AH JavaScript Password Strength Check  >  example2.html  >  Download  
File: example2.html
Role: Example script
Content type: text/plain
Description: Example
Class: AH JavaScript Password Strength Check
Calculate and display the strength of a password
Author: By
Last change: added minified version; min version is used in examples now
Date: 2 years ago
Size: 2,696 bytes
 

Contents

Class file image Download
<!DOCTYPE html>
<html>
    <head>
        <title>Demo 2 for password checker</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <script src="ahpwcheck.class.min.js"></script>
        <link rel="stylesheet" type="text/css" href="example.css" />
    </head>
    <body>
        <h1>Demo 2 for password checker (ahpwcheck.class.js)</h1>
        <nav>
            <a href="example.html">example 1</a>
            <a href="example2.html" class="active">example 2</a>
            <a href="example3.html">example 3</a>
            <a href="example4.html">example 4</a>
            <a href="example5.html">example 5</a>
        </nav>


        <!-- ************************************************************** -->

        
        <h2>Override checks</h2>
        <p class="info">
            Type something. Below the form is an info field that shows
            the kind of typed characters.<br><br>
            The uppercase field updates while typing and turns to green on 4 (or more ... instead of the first).<br>
            The char count turns to green on 6 (or more ... instead of 8).<br>
        </p>
        <form>
            password-field:
            <input type="password" id="ePassword">
        </form>

        <div id="outpwcheck"></div>
        <script id="source">

            var aOptions = {
                'checks': {
                    'lcase':{
                        'required': 0
                    },
                    'ucase':{
                        'required': 4
                    },
                    'count':{
                        'required': 6
                    }
                }
            };
            var oPwCheck = new ahpwcheck(aOptions);
            oPwCheck.watch('ePassword', 'outpwcheck');
        </script>


        <!-- ************************************************************** -->

        
        <h2>Explaination</h2>
        <p>
            Let's override definitions for the checks with an options object.<br>
            In the options use the subkey "checks".<br>
            <br>
            - lcase - disable lowercase (not recommended - it is just for the demo)<br>
            - ucase - set required chars to 4 (default is 1)<br>
            - count - set password length to 6 (default is 8)<br>
        </p>
        
        <script>
            document.write("<pre>" + document.getElementById("source").innerHTML + "</pre>");
        </script>
        
        <hr>
        DOCS: <a href="http://www.axel-hahn.de/docs/ahpwcheck/index.htm" target="_blank">http://www.axel-hahn.de/docs/ahpwcheck/index.htm</a>        
    </body>
</html>