File manager - Edit - /home/ferretapmx/public_html/media/system/js/fields/passwordstrength.min.js
Back
class PasswordStrength{constructor(e){this.lowercase=parseInt(e.lowercase,10)||0,this.uppercase=parseInt(e.uppercase,10)||0,this.numbers=parseInt(e.numbers,10)||0,this.special=parseInt(e.special,10)||0,this.length=parseInt(e.length,10)||12}getScore(e){let i=0,t=0;return["lowercase","uppercase","numbers","special","length"].forEach(s=>{this[s]>0&&(t+=1)}),i+=this.constructor.calc(e,/[a-z]/g,this.lowercase,t),i+=this.constructor.calc(e,/[A-Z]/g,this.uppercase,t),i+=this.constructor.calc(e,/[0-9]/g,this.numbers,t),i+=this.constructor.calc(e,/[@$!#?=;:*\-_€%&()`´+[\]{}'"\\|,.<>/~^]/g,this.special,t),t===1?i+=e.length>this.length?100:100/this.length*e.length:i+=e.length>this.length?100/t:100/t/this.length*e.length,i}static calc(e,i,t,r){const s=e.match(i);return s&&s.length>t&&t!==0?100/r:s&&t>0?100/r/t*s.length:0}}/** * @copyright (C) 2020 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */((u,e)=>{const i=t=>{const r=e.querySelector("meter"),s=t.getAttribute("data-min-length"),c=t.getAttribute("data-min-integers"),n=t.getAttribute("data-min-symbols"),a=t.getAttribute("data-min-uppercase"),o=t.getAttribute("data-min-lowercase"),h=new PasswordStrength({lowercase:o||0,uppercase:a||0,numbers:c||0,special:n||0,length:s||12}).getScore(t.value),p=r.getAttribute("id").replace(/^\D+/g,""),l=t.parentNode.parentNode.querySelector(`#password-${p}`);if(t.value!==t.value.trim()){l.innerText=u.Text._("JFIELD_PASSWORD_SPACES_IN_PASSWORD"),r.value=0;return}l&&(h===100?l.innerText=u.Text._("JFIELD_PASSWORD_INDICATE_COMPLETE"):l.innerText=u.Text._("JFIELD_PASSWORD_INDICATE_INCOMPLETE"),r.value=h,t.value.length||(l.innerText="",t.setAttribute("required","")))};e.addEventListener("DOMContentLoaded",()=>{const t=e.querySelectorAll(".js-password-strength");t.forEach((r,s)=>{let c="";r.value.length||(c=0);const n=e.createElement("meter");n.setAttribute("id",`progress-${s}`),n.setAttribute("min",0),n.setAttribute("max",100),n.setAttribute("low",40),n.setAttribute("high",99),n.setAttribute("optimum",100),n.value=c;const a=e.createElement("div");a.setAttribute("class","text-center"),a.setAttribute("id",`password-${s}`),a.setAttribute("aria-live","polite"),r.parentNode.insertAdjacentElement("afterEnd",a),r.parentNode.insertAdjacentElement("afterEnd",n),r.value.length>0&&r.setAttribute("required",!0),r.addEventListener("keyup",({target:o})=>i(o))}),t[0]&&e.formvalidator.setHandler("password-strength",r=>{if(r!==r.trim())return!1;const s=e.querySelectorAll(".js-password-strength"),c=s[0].getAttribute("data-min-length"),n=s[0].getAttribute("data-min-integers"),a=s[0].getAttribute("data-min-symbols"),o=s[0].getAttribute("data-min-uppercase"),g=s[0].getAttribute("data-min-lowercase");return new PasswordStrength({lowercase:g||0,uppercase:o||0,numbers:n||0,special:a||0,length:c||12}).getScore(r)===100})})})(Joomla,document);
| ver. 1.4 |
Github
|
.
| PHP 8.2.32 | Generation time: 0.06 |
proxy
|
phpinfo
|
Settings