Subversion Repositories ALCASAR

Rev

Rev 2242 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2242 Rev 3026
Line 58... Line 58...
58
	//strOrig = ' texttotrim ';
58
	//strOrig = ' texttotrim ';
59
	//strReversed = strOrig.revstring();
59
	//strReversed = strOrig.revstring();
60
};
60
};
61
 
61
 
62
function chkPass(pwd) {
62
function chkPass(pwd) {
63
	var oScorebar = $("scorebar");
-
 
64
	var oScore = $("score");
63
	var oBar = $("pwprogress");
65
	var oComplexity = $("complexity");
-
 
66
	// Simultaneous variable declaration and value assignment aren't supported in IE apparently
64
	// Simultaneous variable declaration and value assignment aren't supported in IE apparently
67
	// so I'm forced to assign the same value individually per var to support a crappy browser *sigh* 
65
	// so I'm forced to assign the same value individually per var to support a crappy browser *sigh* 
68
	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;
66
	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;
69
	var nMultRepChar=1, nMultConsecSymbol=1;
67
	var nMultRepChar=1, nMultConsecSymbol=1;
70
	var nMultMidChar=2, nMultRequirements=2, nMultConsecAlphaUC=2, nMultConsecAlphaLC=2, nMultConsecNumber=2;
68
	var nMultMidChar=2, nMultRequirements=2, nMultConsecAlphaUC=2, nMultConsecAlphaLC=2, nMultConsecNumber=2;
Line 74... Line 72...
74
	var nTmpAlphaUC="", nTmpAlphaLC="", nTmpNumber="", nTmpSymbol="";
72
	var nTmpAlphaUC="", nTmpAlphaLC="", nTmpNumber="", nTmpSymbol="";
75
	var sAlphaUC="0", sAlphaLC="0", sNumber="0", sSymbol="0", sMidChar="0", sRequirements="0", sAlphasOnly="0", sNumbersOnly="0", sRepChar="0", sConsecAlphaUC="0", sConsecAlphaLC="0", sConsecNumber="0", sSeqAlpha="0", sSeqNumber="0", sSeqSymbol="0";
73
	var sAlphaUC="0", sAlphaLC="0", sNumber="0", sSymbol="0", sMidChar="0", sRequirements="0", sAlphasOnly="0", sNumbersOnly="0", sRepChar="0", sConsecAlphaUC="0", sConsecAlphaLC="0", sConsecNumber="0", sSeqAlpha="0", sSeqNumber="0", sSeqSymbol="0";
76
	var sAlphas = "abcdefghijklmnopqrstuvwxyz";
74
	var sAlphas = "abcdefghijklmnopqrstuvwxyz";
77
	var sNumerics = "01234567890";
75
	var sNumerics = "01234567890";
78
	var sSymbols = ")!@#$%^&*()";
76
	var sSymbols = ")!@#$%^&*()";
-
 
77
	var sColor = "";
79
	var sComplexity = "Trop court";
78
	var sComplexity = "Trop court";
80
	var sStandards = "Below";
-
 
81
	var nMinPwdLen = 8;
79
	var nMinPwdLen = 8;
82
	if (document.all) { var nd = 0; } else { var nd = 1; }
80
	if (document.all) { var nd = 0; } else { var nd = 1; }
83
	if (pwd) {
81
	if (pwd) {
84
		nScore = parseInt(pwd.length * nMultLength);
82
		nScore = parseInt(pwd.length * nMultLength);
85
		nLength = pwd.length;
83
		nLength = pwd.length;
Line 278... Line 276...
278
			else { oImg.className = "pass"; oBonus.parentNode.className = "pass"; }
276
			else { oImg.className = "pass"; oBonus.parentNode.className = "pass"; }
279
		}
277
		}
280
		
278
		
281
		/* Determine complexity based on overall score */
279
		/* Determine complexity based on overall score */
282
		if (nScore > 100) { nScore = 100; } else if (nScore < 0) { nScore = 0; }
280
		if (nScore > 100) { nScore = 100; } else if (nScore < 0) { nScore = 0; }
-
 
281
		if(nScore < 0){}
-
 
282
		else if (nScore < 20) {
-
 
283
			sColor = "bg-dark";
283
		if (nScore >= 0 && nScore < 20) { sComplexity = "Tr&egrave;s Faible"; }
284
			sComplexity = "Tr&egrave;s Faible";
-
 
285
		}
-
 
286
		else if (nScore < 40) {
-
 
287
			sColor = "bg-danger";
284
		else if (nScore >= 20 && nScore < 40) { sComplexity = "Faible"; }
288
			sComplexity = "Faible"; }
-
 
289
		else if (nScore < 60) {
-
 
290
			sColor = "bg-warning";
285
		else if (nScore >= 40 && nScore < 60) { sComplexity = "Moyen"; }
291
			sComplexity = "Moyen"; }
-
 
292
		else if (nScore < 80) {
-
 
293
			sColor = "bg-info";
-
 
294
			sComplexity = "Bon";
-
 
295
		}
286
		else if (nScore >= 60 && nScore < 80) { sComplexity = "Bon"; }
296
		else if (nScore <= 100) {
-
 
297
			sColor = "bg-success";
287
		else if (nScore >= 80 && nScore <= 100) { sComplexity = "Tr&egrave;s bon"; }
298
			sComplexity = "Tr&egrave;s bon";
-
 
299
		}
288
		
300
		
289
		/* Display updated score criteria to client */
301
		/* Display updated score criteria to client */
290
		oScorebar.style.backgroundPosition = "-" + parseInt(nScore * 4) + "px";
302
		oBar.innerHTML = nScore + "% / "+sComplexity;
291
		oScore.innerHTML = nScore + "%";
303
		oBar.style.width = nScore + "%";
292
		oComplexity.innerHTML = sComplexity;
304
		oBar.className = "progress-bar " + sColor;
293
	}
305
	}
294
	else {
306
	else {
295
		/* Display default score criteria to client */
307
		/* Display default score criteria to client */
296
		initPwdChk();
308
		initPwdChk();
297
		oScore.innerHTML = nScore + "%";
309
		oBar.innerHTML = nScore + "%"+sComplexity;
298
		oComplexity.innerHTML = sComplexity;
310
		oBar.style.width = nScore + "%";
-
 
311
		oBar.className = "progress-bar";
299
	}
312
	}
300
}
313
}
301
 
314
 
302
function initPwdChk(restart) {
315
function initPwdChk(restart) {
303
	/* Reset all form values to their default */
316
	/* Reset all form values to their default */