Jump to content

WHMCS client password strength


wtools

Recommended Posts

18 minutes ago, wtools said:

What's the best way to add more rules for client password?

Just like it must be 8 characters and should have special characters and number etc.

How can we do it?

Using a hook?

I suspect you'd have to edit /assets/js/PasswordStrength.js and edit the function...

function getPasswordStrength(pw){
    var pwlength=(pw.length);
    if(pwlength>5)pwlength=5;
    var numnumeric=pw.replace(/[0-9]/g,"");
    var numeric=(pw.length-numnumeric.length);
    if(numeric>3)numeric=3;
    var symbols=pw.replace(/\W/g,"");
    var numsymbols=(pw.length-symbols.length);
    if(numsymbols>3)numsymbols=3;
    var numupper=pw.replace(/[A-Z]/g,"");
    var upper=(pw.length-numupper.length);
    if(upper>3)upper=3;
    var pwstrength=((pwlength*10)-20)+(numeric*10)+(numsymbols*15)+(upper*10);
    if(pwstrength<0){pwstrength=0}
    if(pwstrength>100){pwstrength=100}
    return pwstrength;
}

you can see from the pwstrength formula, how much weight is given to each constituent (length, numbers, capitals, symbols etc), so by altering that formula (or specifically the weight applied to each part), you should get closer to having the password strength that you require.

also, not the default maximum values of each (e.g length = 5, others are 3)... you can adjust these values too to increase the maximum length.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated