From 34f4c14e78c61735fb3b5ade5085f209dce9777a Mon Sep 17 00:00:00 2001 From: Alejandro Blanco Date: Fri, 29 Oct 2021 00:54:36 +0200 Subject: [PATCH] Release v3.1.1 - Fix wordTwoCharacterClasses rule error message not showing up. --- CHANGES.md | 4 ++ bower.json | 2 +- dist/pwstrength-bootstrap.js | 4 +- dist/pwstrength-bootstrap.min.js | 4 +- dist/pwstrength-bootstrap.min.map | 2 +- examples/bootstrap5/rule_options.html | 92 +++++++++++++++++++++++++++ examples/index.html | 1 + examples/pwstrength.js | 4 +- package.json | 2 +- src/rules.js | 2 +- 10 files changed, 107 insertions(+), 10 deletions(-) create mode 100644 examples/bootstrap5/rule_options.html diff --git a/CHANGES.md b/CHANGES.md index c3ba546..2d2caa2 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,9 @@ # CHANGELOG +## 3.1.1 + +- Fix wordTwoCharacterClasses rule error message not showing up. + ## 3.1.0 - Allow chaining after setter methods. diff --git a/bower.json b/bower.json index 826a7ec..2d3c2e4 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "pwstrength-bootstrap", - "version": "3.1.0", + "version": "3.1.1", "homepage": "https://github.com/ablanco/jquery.pwstrength.bootstrap", "authors": [ "Alejandro Blanco " diff --git a/dist/pwstrength-bootstrap.js b/dist/pwstrength-bootstrap.js index 6003444..2704fa1 100644 --- a/dist/pwstrength-bootstrap.js +++ b/dist/pwstrength-bootstrap.js @@ -1,6 +1,6 @@ /*! * jQuery Password Strength plugin for Twitter Bootstrap -* Version: 3.1.0 +* Version: 3.1.1 * * Copyright (c) 2008-2013 Tane Piper * Copyright (c) 2013 Alejandro Blanco @@ -154,7 +154,7 @@ try { ) { return score; } - return 0; + return; }; validation.wordRepetitions = function(options, word, score) { diff --git a/dist/pwstrength-bootstrap.min.js b/dist/pwstrength-bootstrap.min.js index d7e22df..f850afc 100644 --- a/dist/pwstrength-bootstrap.min.js +++ b/dist/pwstrength-bootstrap.min.js @@ -1,4 +1,4 @@ -/* pwstrength-bootstrap 2021-06-01 - GPLv3 & MIT License */ +/* pwstrength-bootstrap 2021-10-29 - GPLv3 & MIT License */ -!function(s){var t={};!function(o){"use strict";t.fallback={wordMinLength:"Your password is too short",wordMaxLength:"Your password is too long",wordInvalidChar:"Your password contains an invalid character",wordNotEmail:"Do not use your email as your password",wordSimilarToUsername:"Your password cannot contain your username",wordTwoCharacterClasses:"Use different character classes",wordRepetitions:"Too many repetitions",wordSequences:"Your password contains sequences",errorList:"Errors:",veryWeak:"Very Weak",weak:"Weak",normal:"Normal",medium:"Medium",strong:"Strong",veryStrong:"Very Strong"},t.t=function(r){var e="";return(e=o?o.t(r):t.fallback[r])===r?"":e}}(window.i18next);var r,c={};try{!s&&module&&module.exports&&(s=require("jquery"),r=require("jsdom").jsdom,s=s(r().defaultView))}catch(r){}!function(i){"use strict";var r={};c.forbiddenSequences=["0123456789","abcdefghijklmnopqrstuvwxyz","qwertyuiop","asdfghjkl","zxcvbnm","!@#$%^&*()_+"],r.wordNotEmail=function(r,e,o){return e.match(/^([\w!#$%&'*+\-/=?^`{|}~]+\.)*[\w!#$%&'*+\-/=?^`{|}~]+@((((([a-z0-9]{1}[a-z0-9-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,6})|(\d{1,3}\.){3}\d{1,3}(:\d{1,5})?)$/i)?o:0},r.wordMinLength=function(r,e,o){var s=e.length,e=Math.pow(s,r.rules.raisePower);return sr.common.maxChar?o:e},r.wordInvalidChar=function(r,e,o){return r.common.invalidCharsRegExp.test(e)?o:0},r.wordMinLengthStaticScore=function(r,e,o){return e.lengthr.common.maxChar?0:o},r.wordSimilarToUsername=function(r,e,o){r=i(r.common.usernameField).val();return r&&e.toLowerCase().match(r.replace(/[-[\]/{}()*+=?:.\\^$|!,]/g,"\\$&").toLowerCase())?o:0},r.wordTwoCharacterClasses=function(r,e,o){r=new RegExp("(."+r.rules.specialCharClass+")");return e.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/)||e.match(/([a-zA-Z])/)&&e.match(/([0-9])/)||e.match(r)&&e.match(/[a-zA-Z0-9_]/)?o:0},r.wordRepetitions=function(r,e,o){return e.match(/(.)\1\1/)?o:0},r.wordSequences=function(r,o,e){var s,t=!1;return 2'+e+"":""},u.ui.popoverError=function(r){"use strict";var e=r.instances.errors,o="
"+r.i18n.t("errorList")+'
    ';return s.each(e,function(r,e){o+="
  • "+e+"
  • "}),o+="
"},u.ui.showVerdicts=!0,u.ui.showVerdictsInsideProgressBar=!1,u.ui.useVerdictCssClass=!1,u.ui.showErrors=!1,u.ui.showScore=!1,u.ui.container=void 0,u.ui.viewports={progress:void 0,verdict:void 0,errors:void 0,score:void 0},u.ui.scores=[0,14,26,38,50],u.i18n={},u.i18n.t=t.t;var d={};!function(n){"use strict";var a=["error","warning","success"],o=["veryWeak","weak","normal","medium","strong","veryStrong"];d.getContainer=function(r,e){r=n(r.ui.container);return r=!r||1!==r.length?e.parent():r},d.findElement=function(r,e,o){return(e?r.find(e):r).find(o)},d.getUIElements=function(r,e){var o;return r.instances.viewports||(o=d.getContainer(r,e),(e={}).$progressbar=d.findElement(o,r.ui.viewports.progress,"div.progress"),r.ui.showVerdictsInsideProgressBar&&(e.$verdict=e.$progressbar.find("span.password-verdict")),r.ui.showPopover||(r.ui.showVerdictsInsideProgressBar||(e.$verdict=d.findElement(o,r.ui.viewports.verdict,"span.password-verdict")),e.$errors=d.findElement(o,r.ui.viewports.errors,"ul.error-list")),e.$score=d.findElement(o,r.ui.viewports.score,"span.password-score"),r.instances.viewports=e)},d.initHelper=function(r,e,o,s){r=d.getContainer(r,e);s?r.find(s).append(o):n(o).insertAfter(e)},d.initVerdict=function(r,e){d.initHelper(r,e,'',r.ui.viewports.verdict)},d.initErrorList=function(r,e){d.initHelper(r,e,'
    ',r.ui.viewports.errors)},d.initScore=function(r,e){d.initHelper(r,e,'',r.ui.viewports.score)},d.initUI=function(r,e){r.ui.showPopover?d.initPopover(r,e):(r.ui.showErrors&&d.initErrorList(r,e),r.ui.showVerdicts&&!r.ui.showVerdictsInsideProgressBar&&d.initVerdict(r,e)),r.ui.showProgressBar&&d.initProgressBar(r,e),r.ui.showScore&&d.initScore(r,e)},d.updateVerdict=function(r,e,o,s){e=d.getUIElements(r,e).$verdict;e.removeClass(r.ui.colorClasses.join(" ")),-1"+e+""}),e.html(s)},d.updateScore=function(r,e,o,s){r=d.getUIElements(r,e).$score,e="";s||(e=o.toFixed(2)),r.html(e)},d.updateFieldStatus=function(o,r,e,s){var t=r;o.ui.bootstrap2?t=r.parents(".control-group").first():o.ui.bootstrap3&&(t=r.parents(".form-group").first()),n.each(a,function(r,e){e=d.cssClassesForBS(o,e),t.removeClass(e)}),s||(e=a[Math.floor(e/2)],e=d.cssClassesForBS(o,e),t.addClass(e))},d.cssClassesForBS=function(r,e){return r.ui.bootstrap3?e="has-"+e:r.ui.bootstrap2||(e="border-"+(e="error"===e?"danger":e)),e},d.getVerdictAndCssClass=function(r,e){return void 0===e?["",0]:(e=e<=r.ui.scores[0]?0:e
    '+o+"",a=!1),r.ui.showErrors&&(0r.common.maxChar?o:e},r.wordInvalidChar=function(r,e,o){return r.common.invalidCharsRegExp.test(e)?o:0},r.wordMinLengthStaticScore=function(r,e,o){return e.lengthr.common.maxChar?0:o},r.wordSimilarToUsername=function(r,e,o){r=i(r.common.usernameField).val();return r&&e.toLowerCase().match(r.replace(/[-[\]/{}()*+=?:.\\^$|!,]/g,"\\$&").toLowerCase())?o:0},r.wordTwoCharacterClasses=function(r,e,o){r=new RegExp("(."+r.rules.specialCharClass+")");if(e.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/)||e.match(/([a-zA-Z])/)&&e.match(/([0-9])/)||e.match(r)&&e.match(/[a-zA-Z0-9_]/))return o},r.wordRepetitions=function(r,e,o){return e.match(/(.)\1\1/)?o:0},r.wordSequences=function(r,o,e){var s,t=!1;return 2'+e+"":""},u.ui.popoverError=function(r){"use strict";var e=r.instances.errors,o="
    "+r.i18n.t("errorList")+'
      ';return s.each(e,function(r,e){o+="
    • "+e+"
    • "}),o+="
    "},u.ui.showVerdicts=!0,u.ui.showVerdictsInsideProgressBar=!1,u.ui.useVerdictCssClass=!1,u.ui.showErrors=!1,u.ui.showScore=!1,u.ui.container=void 0,u.ui.viewports={progress:void 0,verdict:void 0,errors:void 0,score:void 0},u.ui.scores=[0,14,26,38,50],u.i18n={},u.i18n.t=t.t;var d={};!function(n){"use strict";var a=["error","warning","success"],o=["veryWeak","weak","normal","medium","strong","veryStrong"];d.getContainer=function(r,e){r=n(r.ui.container);return r=!r||1!==r.length?e.parent():r},d.findElement=function(r,e,o){return(e?r.find(e):r).find(o)},d.getUIElements=function(r,e){var o;return r.instances.viewports||(o=d.getContainer(r,e),(e={}).$progressbar=d.findElement(o,r.ui.viewports.progress,"div.progress"),r.ui.showVerdictsInsideProgressBar&&(e.$verdict=e.$progressbar.find("span.password-verdict")),r.ui.showPopover||(r.ui.showVerdictsInsideProgressBar||(e.$verdict=d.findElement(o,r.ui.viewports.verdict,"span.password-verdict")),e.$errors=d.findElement(o,r.ui.viewports.errors,"ul.error-list")),e.$score=d.findElement(o,r.ui.viewports.score,"span.password-score"),r.instances.viewports=e)},d.initHelper=function(r,e,o,s){r=d.getContainer(r,e);s?r.find(s).append(o):n(o).insertAfter(e)},d.initVerdict=function(r,e){d.initHelper(r,e,'',r.ui.viewports.verdict)},d.initErrorList=function(r,e){d.initHelper(r,e,'
      ',r.ui.viewports.errors)},d.initScore=function(r,e){d.initHelper(r,e,'',r.ui.viewports.score)},d.initUI=function(r,e){r.ui.showPopover?d.initPopover(r,e):(r.ui.showErrors&&d.initErrorList(r,e),r.ui.showVerdicts&&!r.ui.showVerdictsInsideProgressBar&&d.initVerdict(r,e)),r.ui.showProgressBar&&d.initProgressBar(r,e),r.ui.showScore&&d.initScore(r,e)},d.updateVerdict=function(r,e,o,s){e=d.getUIElements(r,e).$verdict;e.removeClass(r.ui.colorClasses.join(" ")),-1"+e+""}),e.html(s)},d.updateScore=function(r,e,o,s){r=d.getUIElements(r,e).$score,e="";s||(e=o.toFixed(2)),r.html(e)},d.updateFieldStatus=function(o,r,e,s){var t=r;o.ui.bootstrap2?t=r.parents(".control-group").first():o.ui.bootstrap3&&(t=r.parents(".form-group").first()),n.each(a,function(r,e){e=d.cssClassesForBS(o,e),t.removeClass(e)}),s||(e=a[Math.floor(e/2)],e=d.cssClassesForBS(o,e),t.addClass(e))},d.cssClassesForBS=function(r,e){return r.ui.bootstrap3?e="has-"+e:r.ui.bootstrap2||(e="border-"+(e="error"===e?"danger":e)),e},d.getVerdictAndCssClass=function(r,e){return void 0===e?["",0]:(e=e<=r.ui.scores[0]?0:e
      '+o+"",a=!1),r.ui.showErrors&&(0 + + + + + + + Bootstrap 5 Password Strength Meter Example - Rule Options + + + + +
      +

      Bootstrap 5 Password Strength Meter Example - Rule Options

      +
      +
      +
      + + +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      jQuery(document).ready(function () {
      +    "use strict";
      +    var options = {};
      +    options.rules = {
      +        activated: {
      +            wordTwoCharacterClasses: true
      +        },
      +        specialCharClass: "[!,@,#,$,%,^,&,*,?,_,~,+]"
      +    };
      +    options.ui = {
      +        container: "#pwd-container",
      +        viewports: {
      +            progress: ".pwstrength_viewport_progress"
      +        },
      +        showVerdictsInsideProgressBar: true
      +    };
      +    options.common = {
      +        debug: true,
      +        onLoad: function () {
      +            $('#messages').text('Start typing password');
      +        }
      +    };
      +    $(':password').pwstrength(options);
      +});
      +

      Go back

      +
      + + + + + + + + diff --git a/examples/index.html b/examples/index.html index 0ac85ec..b7a118a 100644 --- a/examples/index.html +++ b/examples/index.html @@ -17,6 +17,7 @@

      Bootstrap 5

      1. Basic usage
      2. Show verdict and errors in a popover
      3. +
      4. Personalize special chars rule options

      Bootstrap 4

      diff --git a/examples/pwstrength.js b/examples/pwstrength.js index 6003444..2704fa1 100644 --- a/examples/pwstrength.js +++ b/examples/pwstrength.js @@ -1,6 +1,6 @@ /*! * jQuery Password Strength plugin for Twitter Bootstrap -* Version: 3.1.0 +* Version: 3.1.1 * * Copyright (c) 2008-2013 Tane Piper * Copyright (c) 2013 Alejandro Blanco @@ -154,7 +154,7 @@ try { ) { return score; } - return 0; + return; }; validation.wordRepetitions = function(options, word, score) { diff --git a/package.json b/package.json index b94ee1a..f833a76 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pwstrength-bootstrap", - "version": "3.1.0", + "version": "3.1.1", "description": "jQuery plugin for Twitter Bootstrap that provides rulesets for visualy displaying the quality of a users typed in password.", "author": "Alejandro Blanco ", "homepage": "https://github.com/ablanco/jquery.pwstrength.bootstrap", diff --git a/src/rules.js b/src/rules.js index b4b9991..614f243 100644 --- a/src/rules.js +++ b/src/rules.js @@ -109,7 +109,7 @@ try { ) { return score; } - return 0; + return; }; validation.wordRepetitions = function(options, word, score) {