Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 3025 → Rev 3026

/web/js/pwdmeter.js
60,9 → 60,7
};
 
function chkPass(pwd) {
var oScorebar = $("scorebar");
var oScore = $("score");
var oComplexity = $("complexity");
var oBar = $("pwprogress");
// Simultaneous variable declaration and value assignment aren't supported in IE apparently
// so I'm forced to assign the same value individually per var to support a crappy browser *sigh*
var nScore=0, nLength=0, nAlphaUC=0, nAlphaLC=0, nNumber=0, nSymbol=0, nMidChar=0, nRequirements=0, nAlphasOnly=0, nNumbersOnly=0, nUnqChar=0, nRepChar=0, nRepInc=0, nConsecAlphaUC=0, nConsecAlphaLC=0, nConsecNumber=0, nConsecSymbol=0, nConsecCharType=0, nSeqAlpha=0, nSeqNumber=0, nSeqSymbol=0, nSeqChar=0, nReqChar=0, nMultConsecCharType=0;
76,8 → 74,8
var sAlphas = "abcdefghijklmnopqrstuvwxyz";
var sNumerics = "01234567890";
var sSymbols = ")!@#$%^&*()";
var sColor = "";
var sComplexity = "Trop court";
var sStandards = "Below";
var nMinPwdLen = 8;
if (document.all) { var nd = 0; } else { var nd = 1; }
if (pwd) {
280,22 → 278,37
/* Determine complexity based on overall score */
if (nScore > 100) { nScore = 100; } else if (nScore < 0) { nScore = 0; }
if (nScore >= 0 && nScore < 20) { sComplexity = "Tr&egrave;s Faible"; }
else if (nScore >= 20 && nScore < 40) { sComplexity = "Faible"; }
else if (nScore >= 40 && nScore < 60) { sComplexity = "Moyen"; }
else if (nScore >= 60 && nScore < 80) { sComplexity = "Bon"; }
else if (nScore >= 80 && nScore <= 100) { sComplexity = "Tr&egrave;s bon"; }
if(nScore < 0){}
else if (nScore < 20) {
sColor = "bg-dark";
sComplexity = "Tr&egrave;s Faible";
}
else if (nScore < 40) {
sColor = "bg-danger";
sComplexity = "Faible"; }
else if (nScore < 60) {
sColor = "bg-warning";
sComplexity = "Moyen"; }
else if (nScore < 80) {
sColor = "bg-info";
sComplexity = "Bon";
}
else if (nScore <= 100) {
sColor = "bg-success";
sComplexity = "Tr&egrave;s bon";
}
/* Display updated score criteria to client */
oScorebar.style.backgroundPosition = "-" + parseInt(nScore * 4) + "px";
oScore.innerHTML = nScore + "%";
oComplexity.innerHTML = sComplexity;
oBar.innerHTML = nScore + "% / "+sComplexity;
oBar.style.width = nScore + "%";
oBar.className = "progress-bar " + sColor;
}
else {
/* Display default score criteria to client */
initPwdChk();
oScore.innerHTML = nScore + "%";
oComplexity.innerHTML = sComplexity;
oBar.innerHTML = nScore + "%"+sComplexity;
oBar.style.width = nScore + "%";
oBar.className = "progress-bar";
}
}