CoreFiles by mySites.guru
passwordstrength.min.js1 lines, 3,210 bytes, from Joomla_4.0.0-beta5-Beta-Full_Package.zip
Raw History Compare with 4.0.0-beta4
md5
7cbcb072dc0c3e6c67f4eb618953e95c
sha1
bcf3d7238c248241e0d633822516058c9bfb799f
sha256
e208d16a10a2af64fb58b778d931643c8623f7ae47660be555e37ba84f76fad0
function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),a}var PasswordStrength=function(){function a(b){_classCallCheck(this,a),this.lowercase=parseInt(b.lowercase,10)||0,this.uppercase=parseInt(b.uppercase,10)||0,this.numbers=parseInt(b.numbers,10)||0,this.special=parseInt(b.special,10)||0,this.length=parseInt(b.length,10)||12}return _createClass(a,[{key:"getScore",value:function getScore(a){var b=this,c=0,d=0;return["lowercase","uppercase","numbers","special","length"].forEach(function(a){0<b[a]&&(d+=1)}),c+=this.constructor.calc(a,/[a-z]/g,this.lowercase,d),c+=this.constructor.calc(a,/[A-Z]/g,this.uppercase,d),c+=this.constructor.calc(a,/[0-9]/g,this.numbers,d),c+=this.constructor.calc(a,/[\$\!\#\?\=\;\:\*\-\_\€\%\&\(\)\`\´]/g,this.special,d),c+=1===d?a.length>this.length?100:100/this.length*a.length:a.length>this.length?100/d:100/d/this.length*a.length,c}}],[{key:"calc",value:function calc(a,b,c,d){var e=a.match(b);return e&&e.length>c&&0!==c?100/d:e&&0<c?100/d/c*e.length:0}}]),a}();(function(a,b){var c=function(c){var d=b.querySelector("meter"),e=c.getAttribute("data-min-length"),f=c.getAttribute("data-min-integers"),g=c.getAttribute("data-min-symbols"),h=c.getAttribute("data-min-uppercase"),j=c.getAttribute("data-min-lowercase"),k=new PasswordStrength({lowercase:j||0,uppercase:h||0,numbers:f||0,special:g||0,length:e||12}),l=k.getScore(c.value),m=d.getAttribute("id").replace(/^\D+/g,""),i=c.parentNode.parentNode.querySelector("#password-".concat(m));i.innerText=100===l?a.JText._("JFIELD_PASSWORD_INDICATE_COMPLETE"):a.JText._("JFIELD_PASSWORD_INDICATE_INCOMPLETE"),d.value=l,c.value.length||(i.innerText="",c.setAttribute("required",""))};b.addEventListener("DOMContentLoaded",function(){var a=[].slice.call(b.querySelectorAll(".js-password-strength"));a.forEach(function(a,d){var e="";a.value.length||(e=0);var f=b.createElement("meter");f.setAttribute("id","progress-".concat(d)),f.setAttribute("min",0),f.setAttribute("max",100),f.setAttribute("low",40),f.setAttribute("high",99),f.setAttribute("optimum",100),f.value=e;var g=b.createElement("div");g.setAttribute("class","text-center"),g.setAttribute("id","password-".concat(d)),g.setAttribute("aria-live","polite"),a.parentNode.insertAdjacentElement("afterEnd",g),a.parentNode.insertAdjacentElement("afterEnd",f),0<a.value.length&&a.setAttribute("required",!0),a.addEventListener("keyup",function(a){var b=a.target;c(b)})}),a[0]&&b.formvalidator.setHandler("password-strength",function(a){var c=b.querySelectorAll(".js-password-strength"),d=c[0].getAttribute("data-min-length"),e=c[0].getAttribute("data-min-integers"),f=c[0].getAttribute("data-min-symbols"),g=c[0].getAttribute("data-min-uppercase"),h=c[0].getAttribute("data-min-lowercase"),i=new PasswordStrength({lowercase:h||0,uppercase:g||0,numbers:e||0,special:f||0,length:d||12}),j=i.getScore(a);return!(100!==j)})})})(Joomla,document);

The same content is in 4 releases, Joomla 4.0.0-beta4 to 4.0.0-beta7. See them all, or every version of this file.