From 58cff21cedefeefabb303870d3aea778a85d1e39 Mon Sep 17 00:00:00 2001 From: mdipierro Date: Fri, 21 Sep 2012 22:12:17 -0500 Subject: [PATCH] moved entropy JS in PasswordWidget but the source should be moved in separate file --- VERSION | 2 +- applications/welcome/views/default/user.html | 90 +------------------- gluon/sqlhtml.py | 90 +++++++++++++++++++- gluon/validators.py | 4 + 4 files changed, 95 insertions(+), 91 deletions(-) diff --git a/VERSION b/VERSION index 486b127c..bf2638f2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.0.9 (2012-09-21 22:01:45) stable +Version 2.0.9 (2012-09-21 22:12:11) stable diff --git a/applications/welcome/views/default/user.html b/applications/welcome/views/default/user.html index ef00c0e6..47acab1f 100644 --- a/applications/welcome/views/default/user.html +++ b/applications/welcome/views/default/user.html @@ -15,92 +15,4 @@ pass - +//--> diff --git a/gluon/sqlhtml.py b/gluon/sqlhtml.py index 5e345f7c..f2382e04 100644 --- a/gluon/sqlhtml.py +++ b/gluon/sqlhtml.py @@ -433,6 +433,94 @@ class PasswordWidget(FormWidget): DEFAULT_PASSWORD_DISPLAY = 8*('*') + js = """ + function calc_entropy(mystring) { + /*" calculate a simple entropy for a given string "*/ + var lowerset = 'abcdefghijklmnopqrstuvwxyz'; + var upperset = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; + var numberset = '0123456789'; + var sym1set = '!@#$\%^&*()'; + var sym2set = '~`-_=+[]{}\\|;:\\'",.<>?/'; + var otherset = '0123456789abcdefghijklmnopqrstuvwxyz' + var alphabet = 0; + var other = {}; + var seen = {}; + var lastset = null; + var mystringlist = mystring.split(''); + for (var i=0;i