- md5
- 40ca523b4812bbfc053f1e90b27e4597
- sha1
- 5c1729617d934639f41454fd583de29f2620f213
- sha256
- 203e44637e81a8b6a0c9769bc4e23019bc16547759518535054618061df58ca7
"use strict";var PasswordStrength;PasswordStrength=function(){function e(e){this.lowercase=e.lowercase||0,this.uppercase=e.uppercase||0,this.numbers=e.numbers||0,this.special=e.special||0,this.length=e.length||4}return e.prototype.getScore=function(e){for(var t=0,r=0,s=["lowercase","uppercase","numbers","special","length"],a=0,n=s.length;n>a;a++)this.hasOwnProperty(s[a])&&this[s[a]]>0&&(r+=1);return t+=this.calc(e,/[a-z]/g,this.lowercase,r),t+=this.calc(e,/[A-Z]/g,this.uppercase,r),t+=this.calc(e,/[0-9]/g,this.numbers,r),t+=this.calc(e,/[\$\!\#\?\=\;\:\*\-\_\€\%\&\(\)\`\´]/g,this.special,r),t+=1==r?e.length>this.length?100:100/this.length*e.length:e.length>this.length?100/r:100/r/this.length*e.length},e.prototype.calc=function(e,t,r,s){var a;return(a=e.match(t))&&a.length>r&&0!=r?100/s:a&&r>0?100/s/r*a.length:0},e}(),document.addEventListener("DOMContentLoaded",function(){for(var e=document.querySelectorAll(".js-password-strength"),t=0,r=e.length;t<r;t++){var s="",a="";e[t].value.length||(s=" bg-danger",a=0);var n=document.createElement("div");n.setAttribute("class","progress");var i=document.createElement("div");i.setAttribute("class","progress-bar progress-bar-striped progress-bar-animated"+s),i.style.width=0+a,i.max=100,i.setAttribute("aria-describedby","password-"+t),n.appendChild(i);var o=document.createElement("div");o.setAttribute("class","text-xs-center"),o.setAttribute("id","password-"+t),e[t].parentNode.insertAdjacentElement("afterEnd",o),e[t].parentNode.insertAdjacentElement("afterEnd",n),e[t].value.length>0&&e[t].setAttribute("required",!0),e[t].addEventListener("keyup",function(e){var t,r,s,a,n,i,o,g,l,c;t=e.target,r=t.getAttribute("data-min-length"),s=t.getAttribute("data-min-integers"),a=t.getAttribute("data-min-symbols"),n=t.getAttribute("data-min-uppercase"),i=t.getAttribute("data-min-lowercase"),o=document.querySelector(".progress-bar"),g=new PasswordStrength({lowercase:i||0,uppercase:n||0,numbers:s||0,special:a||0,length:r||4}).getScore(t.value),l=o.getAttribute("aria-describedby").replace(/^\D+/g,""),c=t.parentNode.parentNode.querySelector("#password-"+l),g>79&&(o.setAttribute("class","progress-bar progress-bar-striped progress-bar-animated bg-warning"),c.innerHTML=Joomla.JText._("JFIELD_PASSWORD_INDICATE_COMPLETE")),g>64&&g<80&&(o.setAttribute("class","progress-bar progress-bar-striped progress-bar-animated bg-warning"),c.innerHTML=Joomla.JText._("JFIELD_PASSWORD_INDICATE_INCOMPLETE")),g>50&&g<65&&(o.setAttribute("class","progress-bar progress-bar-striped progress-bar-animated bg-warning"),c.innerHTML=Joomla.JText._("JFIELD_PASSWORD_INDICATE_INCOMPLETE")),g>40&&g<51&&(o.setAttribute("class","progress-bar progress-bar-striped progress-bar-animated bg-warning"),c.innerHTML=Joomla.JText._("JFIELD_PASSWORD_INDICATE_INCOMPLETE")),g<41&&(o.setAttribute("class","progress-bar progress-bar-striped progress-bar-animated bg-danger"),c.innerHTML=Joomla.JText._("JFIELD_PASSWORD_INDICATE_INCOMPLETE")),100===g&&o.setAttribute("class","progress-bar progress-bar-striped progress-bar-animated bg-success"),o.style.width=g+"%",t.value.length||(o.setAttribute("class","progress-bar progress-bar-striped progress-bar-animated"),c.innerHTML="",t.setAttribute("required",""))})}e[0]&&document.formvalidator.setHandler("password-strength",function(e){var t=!1,r=document.querySelectorAll(".js-password-strength"),s=r[0].getAttribute("data-min-length"),a=r[0].getAttribute("data-min-integers"),n=r[0].getAttribute("data-min-symbols"),i=r[0].getAttribute("data-min-uppercase"),o=r[0].getAttribute("data-min-lowercase");return 100===new PasswordStrength({lowercase:o||0,uppercase:i||0,numbers:a||0,special:n||0,length:s||4}).getScore(e)&&(t=!0),t})});
The same content is in 7 releases, Joomla 4.0.0-alpha3 to 4.0.0-alpha10. See them all, or every version of this file.