v. 2015.04.25 Provides password strenght check capabilities via javascript form validation. By Roberto Puzzanghera - http://notes.sagredo.eu ================================================================================================= diff -ruN qmailadmin-1.2.16-original/Makefile.am qmailadmin-1.2.16-pwd-strenght/Makefile.am --- qmailadmin-1.2.16-original/Makefile.am 2011-02-22 15:45:48.000000000 +0100 +++ qmailadmin-1.2.16-pwd-strenght/Makefile.am 2015-04-26 18:25:26.582135494 +0200 @@ -68,6 +68,7 @@ rm -rf $(DESTDIR)@htmllibdir@/html $(mkinstalldirs) $(DESTDIR)@htmllibdir@/html cp $(srcdir)/html/*.html $(DESTDIR)@htmllibdir@/html + cp $(srcdir)/html/*.js $(DESTDIR)@htmllibdir@/html cp $(srcdir)/html/colortable $(DESTDIR)@htmllibdir@/html chmod 755 $(DESTDIR)@htmllibdir@/html chmod 644 $(DESTDIR)@htmllibdir@/html/* diff -ruN qmailadmin-1.2.16-original/Makefile.in qmailadmin-1.2.16-pwd-strenght/Makefile.in --- qmailadmin-1.2.16-original/Makefile.in 2011-02-22 15:45:47.000000000 +0100 +++ qmailadmin-1.2.16-pwd-strenght/Makefile.in 2015-04-26 18:25:26.605134723 +0200 @@ -702,6 +702,7 @@ rm -rf $(DESTDIR)@htmllibdir@/html $(mkinstalldirs) $(DESTDIR)@htmllibdir@/html cp $(srcdir)/html/*.html $(DESTDIR)@htmllibdir@/html + cp $(srcdir)/html/*.js $(DESTDIR)@htmllibdir@/html cp $(srcdir)/html/colortable $(DESTDIR)@htmllibdir@/html chmod 755 $(DESTDIR)@htmllibdir@/html chmod 644 $(DESTDIR)@htmllibdir@/html/* diff -ruN qmailadmin-1.2.16-original/html/add_user.html qmailadmin-1.2.16-pwd-strenght/html/add_user.html --- qmailadmin-1.2.16-original/html/add_user.html 2011-02-22 15:45:47.000000000 +0100 +++ qmailadmin-1.2.16-pwd-strenght/html/add_user.html 2015-04-26 18:25:26.605134723 +0200 @@ -1,3 +1,4 @@ + @@ -32,7 +33,7 @@ -
+ diff -ruN qmailadmin-1.2.16-original/html/change_password.html qmailadmin-1.2.16-pwd-strenght/html/change_password.html --- qmailadmin-1.2.16-original/html/change_password.html 2011-02-22 15:45:47.000000000 +0100 +++ qmailadmin-1.2.16-pwd-strenght/html/change_password.html 2015-04-26 18:25:26.605134723 +0200 @@ -1,8 +1,9 @@ +

##S

- +
##X002: 
diff -ruN qmailadmin-1.2.16-original/html/header.html qmailadmin-1.2.16-pwd-strenght/html/header.html --- qmailadmin-1.2.16-original/html/header.html 2011-02-22 15:45:47.000000000 +0100 +++ qmailadmin-1.2.16-pwd-strenght/html/header.html 2015-04-26 18:25:26.605134723 +0200 @@ -4,3 +4,11 @@ QmailAdmin ##D + diff -ruN qmailadmin-1.2.16-original/html/mod_user.html qmailadmin-1.2.16-pwd-strenght/html/mod_user.html --- qmailadmin-1.2.16-original/html/mod_user.html 2011-02-22 15:45:47.000000000 +0100 +++ qmailadmin-1.2.16-pwd-strenght/html/mod_user.html 2015-04-26 18:25:26.605134723 +0200 @@ -1,3 +1,4 @@ + @@ -75,7 +76,7 @@
##X013
- + diff -ruN qmailadmin-1.2.16-original/html/pwd_strenght_chk.js qmailadmin-1.2.16-pwd-strenght/html/pwd_strenght_chk.js --- qmailadmin-1.2.16-original/html/pwd_strenght_chk.js 1970-01-01 01:00:00.000000000 +0100 +++ qmailadmin-1.2.16-pwd-strenght/html/pwd_strenght_chk.js 2015-04-26 18:25:46.703468786 +0200 @@ -0,0 +1,52 @@ +var allowedSpecialChars = '! # $ % & ( ) * + , - . / : ; < = > ? @ [ ] ^ _ ` { } | ~ \' \"'; +var alertTooShort = 'The password must be at least 8 characters long!\n\nLa password deve contenere almeno 8 caratteri!' +var alertNoDigit = 'You have to insert at least a digit 0-9 in your password!\n\nE\' necessario includere almeno un carattere numerico nella password!'; +var alertNoUpperCase = 'You have to insert at least an uppercase character in your password!\n\nE\' necessario includere almeno una lettera Maiuscola nella password!'; +var alertNoLowerCase = 'You have to insert at least a lowercase character in your password!\n\nE\' necessario includere almeno una lettera minuscola nella password!'; +var alertNoSpecial = "You have to insert at least a special character in your password!\nThe allowed characters follow below.\n\nE\' necessario includere almeno un carattere non alfanumerico nella nella password! I caratteri ammessi sono i seguenti.\n\n"+allowedSpecialChars; + +function testDigit(pwd) +{ + var patt = /[0-9]/; + return patt.test(pwd); +} + +function testUpperCase(pwd) +{ + var patt = /[ABCDEFGHIJKMLNOPQRSTUWXYZ]/; + return patt.test(pwd); +} + +function testLowerCase(pwd) +{ + var patt = /[abcdefghijklmnopqrstuwxyz]/; + return patt.test(pwd); +} + +function testSpecialChar(pwd) +{ + var patt = /[!#$%&\(\)*+,-.\/:;<=>?@[\]^_`{|}~'"]/; + return patt.test(pwd); +} + +function getPwdStrenght(pwd) +{ + //alert(pwd); + if (!testDigit(pwd)) {alert(alertNoDigit); return false;} + if (!testUpperCase(pwd)) {alert(alertNoUpperCase); return false;} + if (!testLowerCase(pwd)) {alert(alertNoLowerCase); return false;} + if (!testSpecialChar(pwd)) {alert(alertNoSpecial); return false;} +} + +function validate_form(thisform,change) +{ + with (thisform) + { + var key = (change==0) ? 'password1' : 'newpass1'; + if (eval(key).value.length<8) {alert(alertTooShort); eval(key).focus(); return false;} + if (getPwdStrenght(eval(key).value)==false) {eval(key).focus(); return false;} + else return true; + } +} + +