1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Check & Display Password Strength 1.2.1

Check and display the strength of the password entered by the user during registration...  |   Print

  1. sgopala
    This is a very simple add-on to check and display the strength of the password entered by the user during registration/password change. It checks the following conditions to create secure password:
    • The password must contain greater than 6 character
    • The password must have both lower and uppercase characters
    • The password must have at least one number
    • The password must have at least one special character

    For xenForo 1.2.0 and above:
    just download and install this add-on.

    For xenForo 1.1.5 and below:

    If you have TMS installed
    , just download and install this add-on.

    If you don't have TMS installed, you have to make the following template changes manually:

    Search for template 'register_form' in AdminCP >> Appearance >> Templates

    Find the following code:
    Code:
    <dd><input type="password" name="password" class="textCtrl OptOut" id="ctrl_password" autocomplete="off" /></dd>
    Replace with the following code:
    Code:
    <script language="javascript" type="text/javascript">
    function pwdStrength(password)
    {
            var desc = new Array();
            desc[0] = "<font color='red'>Very Weak</font>";
            desc[1] = "<font color='red'>Weak</font>";
            desc[2] = "<font color='orange'>Better</font>";
            desc[3] = "<font color='orange'>Medium</font>";
            desc[4] = "<font color='green'>Strong</font>";
            desc[5] = "<font color='green'>Strongest</font>";
            var score  = 0;
            //if password bigger than 6 give 1 point
            if (password.length > 6) score++;
            //if password has both lower and uppercase characters give 1 point
            if ( ( password.match(/[a-z]/) ) && ( password.match(/[A-Z]/) ) ) score++;
            //if password has at least one number give 1 point
            if (password.match(/\d+/)) score++;
            //if password has at least one special caracther give 1 point
            if ( password.match(/.[!,@,#,$,%,^,&,*,?,_,~,-,(,)]/) ) score++;
            //if password bigger than 12 give another 1 point
            if (password.length > 12) score++;
            document.getElementById("pwdDescription").innerHTML = desc[score];
            document.getElementById("pwdStrength").className = "strength" + score;
    }
    </script>
    <dd><input type="password" name="password" class="textCtrl OptOut" id="ctrl_password" autocomplete="off" onkeyup="pwdStrength(this.value)">
    <div id="pwdDescription" class="explain" style="color: red""></div></dd>
    This is what happens:

    screen_capture_2.png

    Demo: www.FixMyStuff.In

    Hope this was helpful.

    You may donate basis your evaluation of the usefulness of the content to you. Donation is not mandatory, however it is greatly appreciated.
    ka_fan2000 likes this.

Recent Reviews

  1. alex27
    alex27
    5/5,
    Version: 1.0.3
    Excellent addon I saw and I liked working here, so to install it on my website. Congratulations