Commit 72a196c1 authored by Vincent Pelletier's avatar Vincent Pelletier

erp5_jquery_plugin_validation: Add password validation plugin.

parent 2b993f1f
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts92037294.88</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
<value> <string>password.css</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/css</string> </value>
</item>
<item>
<key> <string>data</string> </key>
<value> <string>.password-meter {\n
\tposition:relative;\n
\twidth: 180px;\n
}\n
.password-meter-message {\n
\ttext-align: right;\n
\tfont-weight: bold;\n
\tcolor: #676767;\n
}\n
.password-meter-bg, .password-meter-bar {\n
\theight: 4px;\n
}\n
.password-meter-bg {\n
\ttop: 8px;\n
\tbackground: #e0e0e0;\n
}\n
\n
.password-meter-message-very-weak {\n
\tcolor: #aa0033;\n
}\n
.password-meter-message-weak {\n
\tcolor: #f5ac00;\n
}\n
.password-meter-message-good {\n
\tcolor: #6699cc;\n
}\n
.password-meter-message-strong {\n
\tcolor: #008000;\n
}\n
\n
.password-meter-bg .password-meter-very-weak {\n
\tbackground: #aa0033;\n
\twidth: 30px;\n
}\n
.password-meter-bg .password-meter-weak {\n
\tbackground: #f5ac00;\n
\twidth: 60px;\n
}\n
.password-meter-bg .password-meter-good {\n
\tbackground: #6699cc;\n
\twidth: 135px;\n
}\n
.password-meter-bg .password-meter-strong {\n
\tbackground: #008000;\n
\twidth: 180px;\n
}</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>size</string> </key>
<value> <int>791</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>jquery.validate.password.css</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts92037320.57</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
<value> <string>password.js</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>application/javascript</string> </value>
</item>
<item>
<key> <string>data</string> </key>
<value> <string encoding="cdata"><![CDATA[
/*\n
* jQuery validate.password plug-in 1.0\n
*\n
* http://bassistance.de/jquery-plugins/jquery-plugin-validate.password/\n
*\n
* Copyright (c) 2009 Jörn Zaefferer\n
*\n
* $Id$\n
*\n
* Dual licensed under the MIT and GPL licenses:\n
* http://www.opensource.org/licenses/mit-license.php\n
* http://www.gnu.org/licenses/gpl.html\n
*/\n
(function($) {\n
\t\n
\tvar LOWER = /[a-z]/,\n
\t\tUPPER = /[A-Z]/,\n
\t\tDIGIT = /[0-9]/,\n
\t\tDIGITS = /[0-9].*[0-9]/,\n
\t\tSPECIAL = /[^a-zA-Z0-9]/,\n
\t\tSAME = /^(.)\\1+$/;\n
\t\t\n
\tfunction rating(rate, message) {\n
\t\treturn {\n
\t\t\trate: rate,\n
\t\t\tmessageKey: message\n
\t\t};\n
\t}\n
\t\n
\tfunction uncapitalize(str) {\n
\t\treturn str.substring(0, 1).toLowerCase() + str.substring(1);\n
\t}\n
\t\n
\t$.validator.passwordRating = function(password, username) {\n
\t\tif (!password || password.length < 8)\n
\t\t\treturn rating(0, "too-short");\n
\t\tif (username && password.toLowerCase().match(username.toLowerCase()))\n
\t\t\treturn rating(0, "similar-to-username");\n
\t\tif (SAME.test(password))\n
\t\t\treturn rating(1, "very-weak");\n
\t\t\n
\t\tvar lower = LOWER.test(password),\n
\t\t\tupper = UPPER.test(uncapitalize(password)),\n
\t\t\tdigit = DIGIT.test(password),\n
\t\t\tdigits = DIGITS.test(password),\n
\t\t\tspecial = SPECIAL.test(password);\n
\t\t\n
\t\tif (lower && upper && digit || lower && digits || upper && digits || special)\n
\t\t\treturn rating(4, "strong");\n
\t\tif (lower && upper || lower && digit || upper && digit)\n
\t\t\treturn rating(3, "good");\n
\t\treturn rating(2, "weak");\n
\t}\n
\t\n
\t$.validator.passwordRating.messages = {\n
\t\t"similar-to-username": "Too similar to username",\n
\t\t"too-short": "Too short",\n
\t\t"very-weak": "Very weak",\n
\t\t"weak": "Weak",\n
\t\t"good": "Good",\n
\t\t"strong": "Strong"\n
\t}\n
\t\n
\t$.validator.addMethod("password", function(value, element, usernameField) {\n
\t\t// use untrimmed value\n
\t\tvar password = element.value,\n
\t\t// get username for comparison, if specified\n
\t\t\tusername = $(typeof usernameField != "boolean" ? usernameField : []);\n
\t\t\t\n
\t\tvar rating = $.validator.passwordRating(password, username.val());\n
\t\t// update message for this field\n
\t\t\n
\t\tvar meter = $(".password-meter", element.form);\n
\t\t\n
\t\tmeter.find(".password-meter-bar").removeClass().addClass("password-meter-bar").addClass("password-meter-" + rating.messageKey);\n
\t\tmeter.find(".password-meter-message")\n
\t\t.removeClass()\n
\t\t.addClass("password-meter-message")\n
\t\t.addClass("password-meter-message-" + rating.messageKey)\n
\t\t.text($.validator.passwordRating.messages[rating.messageKey]);\n
\t\t// display process bar instead of error message\n
\t\t\n
\t\treturn rating.rate > 2;\n
\t}, "&nbsp;");\n
\t// manually add class rule, to make username param optional\n
\t$.validator.classRuleSettings.password = { password: true };\n
\t\n
})(jQuery);\n
]]></string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>size</string> </key>
<value> <int>2618</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>jquery.validate.password.js</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
This Business Template contains only static files of jquery validation plugin 1.11.1. This Business Template contains only static files of jquery validation plugin 1.11.1 and password validation plugin 1.0 .
* http://bassistance.de/jquery-plugins/jquery-plugin-validation/ * http://bassistance.de/jquery-plugins/jquery-plugin-validation/
* http://bassistance.de/jquery-plugins/jquery-plugin-password-validation/
* http://docs.jquery.com/Plugins/Validation * http://docs.jquery.com/Plugins/Validation
\ No newline at end of file
3 4
\ No newline at end of file \ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment