From 07c694f017ff4891a64fb469f2c34d1847ec685d Mon Sep 17 00:00:00 2001 From: Moritz W Date: Mon, 10 Jan 2022 22:30:30 +0100 Subject: [PATCH 1/5] Add a simple password requirements indicator This will check the Joomla password requirements and display a small text box that shows which requirements are satisfied and which are not. --- .../fabrik_element/password/forms/fields.xml | 10 +++ .../de-DE.plg_fabrik_element_password.ini | 5 ++ .../en-GB.plg_fabrik_element_password.ini | 8 ++ .../layouts/fabrik-element-password-form.php | 28 ++++++ .../fabrik_element/password/password-min.js | 10 ++- plugins/fabrik_element/password/password.js | 87 ++++++++++++++++++- plugins/fabrik_element/password/password.php | 27 ++++++ 7 files changed, 170 insertions(+), 5 deletions(-) diff --git a/plugins/fabrik_element/password/forms/fields.xml b/plugins/fabrik_element/password/forms/fields.xml index 31d4c177420..5954fb31718 100644 --- a/plugins/fabrik_element/password/forms/fields.xml +++ b/plugins/fabrik_element/password/forms/fields.xml @@ -34,6 +34,16 @@ + + + + + showPasswordRequirements) : + ?> +
+ + + passwordMinLength; ?> +
+ + + passwordMinIntegers; ?> +
+ + + passwordMinSymbols . " (one of: @$!%*#?&)"; ?> +
+ + + passwordMinUppercase; ?> +
+ + + passwordMinLowercase; ?> + + +
+ " /> diff --git a/plugins/fabrik_element/password/password-min.js b/plugins/fabrik_element/password/password-min.js index b080f910c89..d74f26e5ca4 100644 --- a/plugins/fabrik_element/password/password-min.js +++ b/plugins/fabrik_element/password/password-min.js @@ -1,3 +1,7 @@ -/*! Fabrik */ - -define(["jquery","fab/element"],function(d,e){return window.FbPassword=new Class({Extends:e,options:{progressbar:!1},initialize:function(e,t){this.parent(e,t),this.options.editable&&this.ini()},ini:function(){this.element&&this.element.addEvent("keyup",function(e){this.passwordChanged(e)}.bind(this)),!0===this.options.ajax_validation&&this.getConfirmationField().addEvent("blur",function(e){this.callvalidation(e)}.bind(this)),""===this.getConfirmationField().get("value")&&(this.getConfirmationField().value=this.element.value),Fabrik.addEvent("fabrik.form.doelementfx",function(e,t,i,a){if(e===this.form&&i===this.strElement)switch(t){case"disable":d(this.getConfirmationField()).prop("disabled",!0);break;case"enable":d(this.getConfirmationField()).prop("disabled",!1);break;case"readonly":d(this.getConfirmationField()).prop("readonly",!0);break;case"notreadonly":d(this.getConfirmationField()).prop("readonly",!1)}}.bind(this))},callvalidation:function(e){this.form.doElementValidation(e,!1,"_check")},cloned:function(e){console.log("cloned"),this.parent(e),this.ini()},passwordChanged:function(){var e=this.getContainer().getElement(".strength");if("null"!==typeOf(e)){var t=new RegExp("^(?=.{6,})(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*\\W).*$","g"),i=new RegExp("^(?=.{6,})(((?=.*[A-Z])(?=.*[a-z]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[a-z])(?=.*[0-9]))).*$","g"),a=new RegExp("(?=.{6,}).*","g"),n=this.element,o="";if(this.options.progressbar){var s,r="";s=t.test(n.value)?(r=Joomla.JText._("PLG_ELEMENT_PASSWORD_STRONG"),d(Fabrik.jLayouts["fabrik-progress-bar-strong"])):i.test(n.value)?(r=Joomla.JText._("PLG_ELEMENT_PASSWORD_MEDIUM"),d(Fabrik.jLayouts["fabrik-progress-bar-medium"])):a.test(n.value)?(r=Joomla.JText._("PLG_ELEMENT_PASSWORD_WEAK"),d(Fabrik.jLayouts["fabrik-progress-bar-weak"])):(r=Joomla.JText._("PLG_ELEMENT_PASSWORD_MORE_CHARACTERS"),d(Fabrik.jLayouts["fabrik-progress-bar-more"]));var l={title:r};d(s).tooltip(l),d(e).replaceWith(s)}else o=!1===a.test(n.value)?""+Joomla.JText._("PLG_ELEMENT_PASSWORD_MORE_CHARACTERS")+"":t.test(n.value)?''+Joomla.JText._("PLG_ELEMENT_PASSWORD_STRONG")+"":i.test(n.value)?''+Joomla.JText._("PLG_ELEMENT_PASSWORD_MEDIUM")+"":''+Joomla.JText._("PLG_ELEMENT_PASSWORD_WEAK")+"",e.set("html",o)}},getConfirmationField:function(){return this.getContainer().getElement("input[name*=check]")}}),window.FbPassword}); \ No newline at end of file +/** + * Password Element + * + * @copyright: Copyright (C) 2005-2016 Media A-Team, Inc. - All rights reserved. + * @license: GNU/GPL http://www.gnu.org/copyleft/gpl.html + */ +define(["jquery","fab/element"],(function(e,t){return window.FbPassword=new Class({Extends:t,options:{progressbar:!1},initialize:function(e,t){this.parent(e,t),this.options.editable&&this.ini()},ini:function(){this.pwRequirementsIndicator=this.getContainer().getElement("#pw-requirements-indicator"),"null"===typeOf(this.pwRequirementsIndicator)&&console.log("Password requirements indicator not found in DOM!"),this.pwMinLen=Joomla.getOptions("passwordMinLength"),this.pwMinInts=Joomla.getOptions("passwordMinIntegers"),this.pwMinSymbols=Joomla.getOptions("passwordMinSymbols"),this.pwMinUppercase=Joomla.getOptions("passwordMinUppercase"),this.pwMinLowercase=Joomla.getOptions("passwordMinLowercase"),this.pwRequirementMinLenText=Joomla.JText._("PLG_ELEMENT_PASSWORD_MIN_LENGTH")+": "+this.pwMinLen,this.pwRequirementMinIntsText=Joomla.JText._("PLG_ELEMENT_PASSWORD_MIN_INTEGERS")+": "+this.pwMinInts,this.pwRequirementMinSymbolsText=Joomla.JText._("PLG_ELEMENT_PASSWORD_MIN_SYMBOLS")+": "+this.pwMinSymbols+" (one of: @$!%*#?&)",this.pwRequirementMinUppercaseText=Joomla.JText._("PLG_ELEMENT_PASSWORD_MIN_UPPERCASE")+": "+this.pwMinUppercase,this.pwRequirementMinLowercaseText=Joomla.JText._("PLG_ELEMENT_PASSWORD_MIN_LOWERCASE")+": "+this.pwMinLowercase,this.element&&this.element.addEvent("keyup",function(e){this.passwordChanged(e)}.bind(this)),!0===this.options.ajax_validation&&this.getConfirmationField().addEvent("blur",function(e){this.callvalidation(e)}.bind(this)),""===this.getConfirmationField().get("value")&&(this.getConfirmationField().value=this.element.value),Fabrik.addEvent("fabrik.form.doelementfx",function(t,n,s,i){if(t===this.form&&s===this.strElement)switch(n){case"disable":e(this.getConfirmationField()).prop("disabled",!0);break;case"enable":e(this.getConfirmationField()).prop("disabled",!1);break;case"readonly":e(this.getConfirmationField()).prop("readonly",!0);break;case"notreadonly":e(this.getConfirmationField()).prop("readonly",!1)}}.bind(this))},callvalidation:function(e){this.form.doElementValidation(e,!1,"_check")},cloned:function(e){console.log("cloned"),this.parent(e),this.ini()},passwordChanged:function(){var t=this.element,n="";if("null"!==typeOf(this.pwRequirementsIndicator)){let e,s=0;for(t.value.length>=this.pwMinLen?n+=' '+this.pwRequirementMinLenText+"
":n+=' '+this.pwRequirementMinLenText+"
",s=0,e=new RegExp("[0-9]","g");e.test(t.value);)s++;for(s>=this.pwMinInts?n+=' '+this.pwRequirementMinIntsText+"
":n+=' '+this.pwRequirementMinIntsText+"
",s=0,e=new RegExp("[@$!%*#?&]","g");e.test(t.value);)s++;for(s>=this.pwMinSymbols?n+=' '+this.pwRequirementMinSymbolsText+"
":n+=' '+this.pwRequirementMinSymbolsText+"
",s=0,e=new RegExp("[A-Z]","g");e.test(t.value);)s++;for(s>=this.pwMinUppercase?n+=' '+this.pwRequirementMinUppercaseText+"
":n+=' '+this.pwRequirementMinUppercaseText+"
",s=0,e=new RegExp("[a-z]","g");e.test(t.value);)s++;s>=this.pwMinLowercase?n+=' '+this.pwRequirementMinLowercaseText+"":n+=' '+this.pwRequirementMinLowercaseText+"",this.pwRequirementsIndicator.set("html",n)}var s=this.getContainer().getElement(".strength");if("null"!==typeOf(s)){n="";var i=new RegExp("^(?=.{6,})(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*\\W).*$","g"),a=new RegExp("^(?=.{6,})(((?=.*[A-Z])(?=.*[a-z]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[a-z])(?=.*[0-9]))).*$","g"),o=new RegExp("(?=.{6,}).*","g");if(this.options.progressbar){var r,p="";i.test(t.value)?(p=Joomla.JText._("PLG_ELEMENT_PASSWORD_STRONG"),r=e(Fabrik.jLayouts["fabrik-progress-bar-strong"])):a.test(t.value)?(p=Joomla.JText._("PLG_ELEMENT_PASSWORD_MEDIUM"),r=e(Fabrik.jLayouts["fabrik-progress-bar-medium"])):o.test(t.value)?(p=Joomla.JText._("PLG_ELEMENT_PASSWORD_WEAK"),r=e(Fabrik.jLayouts["fabrik-progress-bar-weak"])):(p=Joomla.JText._("PLG_ELEMENT_PASSWORD_MORE_CHARACTERS"),r=e(Fabrik.jLayouts["fabrik-progress-bar-more"]));var l={title:p};e(r).tooltip(l),e(s).replaceWith(r)}else n=!1===o.test(t.value)?""+Joomla.JText._("PLG_ELEMENT_PASSWORD_MORE_CHARACTERS")+"":i.test(t.value)?''+Joomla.JText._("PLG_ELEMENT_PASSWORD_STRONG")+"":a.test(t.value)?''+Joomla.JText._("PLG_ELEMENT_PASSWORD_MEDIUM")+"":''+Joomla.JText._("PLG_ELEMENT_PASSWORD_WEAK")+"",s.set("html",n)}},getConfirmationField:function(){return this.getContainer().getElement("input[name*=check]")}}),window.FbPassword})); diff --git a/plugins/fabrik_element/password/password.js b/plugins/fabrik_element/password/password.js index e04cd03cf46..7e4bd5d38ab 100644 --- a/plugins/fabrik_element/password/password.js +++ b/plugins/fabrik_element/password/password.js @@ -22,6 +22,24 @@ define(['jquery', 'fab/element'], function (jQuery, FbElement) { }, ini: function () { + + this.pwRequirementsIndicator = this.getContainer().getElement('#pw-requirements-indicator'); + if (typeOf(this.pwRequirementsIndicator) === 'null') { + console.log("Password requirements indicator not found in DOM!"); + } + + this.pwMinLen = Joomla.getOptions('passwordMinLength'); + this.pwMinInts = Joomla.getOptions('passwordMinIntegers'); + this.pwMinSymbols = Joomla.getOptions('passwordMinSymbols'); + this.pwMinUppercase = Joomla.getOptions('passwordMinUppercase'); + this.pwMinLowercase = Joomla.getOptions('passwordMinLowercase'); + + this.pwRequirementMinLenText = Joomla.JText._('PLG_ELEMENT_PASSWORD_MIN_LENGTH') + ': ' + this.pwMinLen; + this.pwRequirementMinIntsText = Joomla.JText._('PLG_ELEMENT_PASSWORD_MIN_INTEGERS') + ': ' + this.pwMinInts; + this.pwRequirementMinSymbolsText = Joomla.JText._('PLG_ELEMENT_PASSWORD_MIN_SYMBOLS') + ': ' + this.pwMinSymbols + ' (one of: @$!%*#?&)'; + this.pwRequirementMinUppercaseText = Joomla.JText._('PLG_ELEMENT_PASSWORD_MIN_UPPERCASE') + ': ' + this.pwMinUppercase; + this.pwRequirementMinLowercaseText = Joomla.JText._('PLG_ELEMENT_PASSWORD_MIN_LOWERCASE') + ': ' + this.pwMinLowercase; + if (this.element) { this.element.addEvent('keyup', function (e) { this.passwordChanged(e); @@ -69,15 +87,80 @@ define(['jquery', 'fab/element'], function (jQuery, FbElement) { }, passwordChanged: function () { + + var pwd = this.element; + var html = ''; + + /* Update the password requirements indicator */ + if (typeOf(this.pwRequirementsIndicator) !== 'null') + { + let regexExpr, count = 0; + + // check if password length is sufficient + if (pwd.value.length >= this.pwMinLen) { + html += ' ' + this.pwRequirementMinLenText + '
'; + } else { + html += ' ' + this.pwRequirementMinLenText + '
'; + } + + // check if password contains enough digits + count = 0; + regexExpr = new RegExp("[0-9]", 'g'); + while(regexExpr.test(pwd.value)) count++; + + if (count >= this.pwMinInts) { + html += ' ' + this.pwRequirementMinIntsText + '
'; + } else { + html += ' ' + this.pwRequirementMinIntsText + '
'; + } + + // check if password contains enough symbols + count = 0; + regexExpr = new RegExp("[@$!%*#?&]", 'g'); + while(regexExpr.test(pwd.value)) count++; + + if (count >= this.pwMinSymbols) { + html += ' ' + this.pwRequirementMinSymbolsText + '
'; + } else { + html += ' ' + this.pwRequirementMinSymbolsText + '
'; + } + + // check if password contains enough upper case characters + count = 0; + regexExpr = new RegExp("[A-Z]", 'g'); + while(regexExpr.test(pwd.value)) count++; + + if (count >= this.pwMinUppercase) { + html += ' ' + this.pwRequirementMinUppercaseText + '
'; + } else { + html += ' ' + this.pwRequirementMinUppercaseText + '
'; + } + + // check if password contains enough lower case characters + count = 0; + regexExpr = new RegExp("[a-z]", 'g'); + while(regexExpr.test(pwd.value)) count++; + + if (count >= this.pwMinLowercase) { + html += ' ' + this.pwRequirementMinLowercaseText + ''; + } else { + html += ' ' + this.pwRequirementMinLowercaseText + ''; + } + + this.pwRequirementsIndicator.set('html', html); + } + + /* Update the password strength meter */ var strength = this.getContainer().getElement('.strength'); if (typeOf(strength) === 'null') { return; } + + html = ''; var strongRegex = new RegExp("^(?=.{6,})(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*\\W).*$", "g"); var mediumRegex = new RegExp("^(?=.{6,})(((?=.*[A-Z])(?=.*[a-z]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[a-z])(?=.*[0-9]))).*$", "g"); var enoughRegex = new RegExp("(?=.{6,}).*", "g"); - var pwd = this.element; - var html = ''; + if (!this.options.progressbar) { if (false === enoughRegex.test(pwd.value)) { html = '' + Joomla.JText._('PLG_ELEMENT_PASSWORD_MORE_CHARACTERS') + ''; diff --git a/plugins/fabrik_element/password/password.php b/plugins/fabrik_element/password/password.php index 1fa63458eca..f9ec8f7bc18 100644 --- a/plugins/fabrik_element/password/password.php +++ b/plugins/fabrik_element/password/password.php @@ -1,4 +1,7 @@ addScriptOptions('passwordMinLength', $pw_requirements_params->get('minimum_length', 8)); + $document->addScriptOptions('passwordMinIntegers', $pw_requirements_params->get('minimum_integers', 0)); + $document->addScriptOptions('passwordMinSymbols', $pw_requirements_params->get('minimum_symbols', 0)); + $document->addScriptOptions('passwordMinUppercase', $pw_requirements_params->get('minimum_uppercase', 0)); + $document->addScriptOptions('passwordMinLowercase', $pw_requirements_params->get('minimum_lowercase', 0)); + } + $extraClass = 'strength ' . $params->get('bootstrap_class', ''); $extraStyle = 'margin-top: 20px;'; @@ -155,6 +170,13 @@ public function render($data, $repeatCounter = 0) $layoutData->bootstrapClass = $params->get('bootstrap_class', ''); $layoutData->extraStyle = $extraStyle; $layoutData->showStrengthMeter = $params->get('strength_meter', 1) == 1; + $layoutData->showPasswordRequirements = $params->get('password_requirements_indicator', 1) == 1; + + $layoutData->passwordMinLength = $pw_requirements_params->get('minimum_length', 8); + $layoutData->passwordMinIntegers = $pw_requirements_params->get('minimum_integers', 0); + $layoutData->passwordMinSymbols = $pw_requirements_params->get('minimum_symbols', 0); + $layoutData->passwordMinUppercase = $pw_requirements_params->get('minimum_uppercase', 0); + $layoutData->passwordMinLowercase = $pw_requirements_params->get('minimum_lowercase', 0); return $layout->render($layoutData); } @@ -269,6 +291,11 @@ public function elementJavascript($repeatCounter) JText::script('PLG_ELEMENT_PASSWORD_WEAK'); JText::script('PLG_ELEMENT_PASSWORD_TYPE_PASSWORD'); JText::script('PLG_ELEMENT_PASSWORD_MORE_CHARACTERS'); + JText::script('PLG_ELEMENT_PASSWORD_MIN_LENGTH'); + JText::script('PLG_ELEMENT_PASSWORD_MIN_INTEGERS'); + JText::script('PLG_ELEMENT_PASSWORD_MIN_SYMBOLS'); + JText::script('PLG_ELEMENT_PASSWORD_MIN_UPPERCASE'); + JText::script('PLG_ELEMENT_PASSWORD_MIN_LOWERCASE'); return array('FbPassword', $id, $opts); } From c46eece0a2ce1b653fd630fb735bc67f50d450cd Mon Sep 17 00:00:00 2001 From: Moritz W Date: Tue, 11 Jan 2022 20:50:00 +0100 Subject: [PATCH 2/5] Add additional translations --- .../language/de-DE/de-DE.plg_fabrik_element_password.ini | 6 +++++- .../language/en-GB/en-GB.plg_fabrik_element_password.ini | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/fabrik_element/password/language/de-DE/de-DE.plg_fabrik_element_password.ini b/plugins/fabrik_element/password/language/de-DE/de-DE.plg_fabrik_element_password.ini index dbf571fde1d..d43af259578 100644 --- a/plugins/fabrik_element/password/language/de-DE/de-DE.plg_fabrik_element_password.ini +++ b/plugins/fabrik_element/password/language/de-DE/de-DE.plg_fabrik_element_password.ini @@ -18,11 +18,15 @@ PLG_ELEMENT_PASSWORD_PASSWORD_CONFIRMATION_EMPTY_NOT_ALLOWED="Sie müssen ein Pa ; PLG_ELEMENT_PASSWORD_SHOW_STRENGTH_METER_LABEL="Show password strength" ; PLG_ELEMENT_PASSWORD_JRULE_VALIDATION_DESC="If set to yes then the password will be checked against com_users' component options. Here you can for example set the number of integers or symbols required in the password" ; PLG_ELEMENT_PASSWORD_JRULE_VALIDATION_LABEL="Joomla password validation" -PLG_ELEMENT_PASSWORD_MIN_LENGTH="Erforderliche Passwort Laenge" +; Password requirements check +PLG_ELEMENT_PASSWORD_MIN_LENGTH="Erforderliche Passwort Länge" PLG_ELEMENT_PASSWORD_MIN_INTEGERS="Anzahl der Ziffern" PLG_ELEMENT_PASSWORD_MIN_SYMBOLS="Anzahl der Sonderzeichen" PLG_ELEMENT_PASSWORD_MIN_UPPERCASE="Grossbuchstaben" PLG_ELEMENT_PASSWORD_MIN_LOWERCASE="Kleinbuchstaben" +PLG_ELEMENT_PASSWORD_ONE_OF="eines von" +PLG_ELEMENT_PASSWORD_MATCH="Die Passwörter stimmen überein" +PLG_ELEMENT_PASSWORD_DONT_MATCH="Die Passwörter stimmen nicht überein" ;Front end PLG_ELEMENT_PASSWORD_VALIDATION_TIP="Geben Sie bitte ein Passwort ein und stellen Sie sicher, dass es mit dem Bestätigungsfeld übereinstimmt." diff --git a/plugins/fabrik_element/password/language/en-GB/en-GB.plg_fabrik_element_password.ini b/plugins/fabrik_element/password/language/en-GB/en-GB.plg_fabrik_element_password.ini index 0e13ea37bab..64c508a4320 100644 --- a/plugins/fabrik_element/password/language/en-GB/en-GB.plg_fabrik_element_password.ini +++ b/plugins/fabrik_element/password/language/en-GB/en-GB.plg_fabrik_element_password.ini @@ -26,6 +26,9 @@ PLG_ELEMENT_PASSWORD_MIN_INTEGERS="Number of digits" PLG_ELEMENT_PASSWORD_MIN_SYMBOLS="Number of symbols" PLG_ELEMENT_PASSWORD_MIN_UPPERCASE="Uppercase characters" PLG_ELEMENT_PASSWORD_MIN_LOWERCASE="Lowercase characters" +PLG_ELEMENT_PASSWORD_ONE_OF="one of" +PLG_ELEMENT_PASSWORD_MATCH="Passwords match" +PLG_ELEMENT_PASSWORD_DONT_MATCH="Passwords don't match" ;Front end PLG_ELEMENT_PASSWORD_VALIDATION_TIP="Please enter a password and ensure that the confirmation matches" From 702bfdd14644c4c4411304269b1ff617ce8c805a Mon Sep 17 00:00:00 2001 From: Moritz W Date: Tue, 11 Jan 2022 20:50:41 +0100 Subject: [PATCH 3/5] Localize the 'one of' text and add a line to indicate if passwords match --- .../layouts/fabrik-element-password-form.php | 6 +++++- plugins/fabrik_element/password/password-min.js | 2 +- plugins/fabrik_element/password/password.js | 17 ++++++++++++++--- plugins/fabrik_element/password/password.php | 3 +++ 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/plugins/fabrik_element/password/layouts/fabrik-element-password-form.php b/plugins/fabrik_element/password/layouts/fabrik-element-password-form.php index 9dbae70247e..692b18fd2b7 100644 --- a/plugins/fabrik_element/password/layouts/fabrik-element-password-form.php +++ b/plugins/fabrik_element/password/layouts/fabrik-element-password-form.php @@ -52,7 +52,7 @@
- passwordMinSymbols . " (one of: @$!%*#?&)"; ?> + passwordMinSymbols . " (" . FText::_('PLG_ELEMENT_PASSWORD_ONE_OF') . ": @$!%*#?&)"; ?>
@@ -61,6 +61,10 @@ passwordMinLowercase; ?> +
+ + + diff --git a/plugins/fabrik_element/password/password-min.js b/plugins/fabrik_element/password/password-min.js index d74f26e5ca4..9fbd9ef3602 100644 --- a/plugins/fabrik_element/password/password-min.js +++ b/plugins/fabrik_element/password/password-min.js @@ -4,4 +4,4 @@ * @copyright: Copyright (C) 2005-2016 Media A-Team, Inc. - All rights reserved. * @license: GNU/GPL http://www.gnu.org/copyleft/gpl.html */ -define(["jquery","fab/element"],(function(e,t){return window.FbPassword=new Class({Extends:t,options:{progressbar:!1},initialize:function(e,t){this.parent(e,t),this.options.editable&&this.ini()},ini:function(){this.pwRequirementsIndicator=this.getContainer().getElement("#pw-requirements-indicator"),"null"===typeOf(this.pwRequirementsIndicator)&&console.log("Password requirements indicator not found in DOM!"),this.pwMinLen=Joomla.getOptions("passwordMinLength"),this.pwMinInts=Joomla.getOptions("passwordMinIntegers"),this.pwMinSymbols=Joomla.getOptions("passwordMinSymbols"),this.pwMinUppercase=Joomla.getOptions("passwordMinUppercase"),this.pwMinLowercase=Joomla.getOptions("passwordMinLowercase"),this.pwRequirementMinLenText=Joomla.JText._("PLG_ELEMENT_PASSWORD_MIN_LENGTH")+": "+this.pwMinLen,this.pwRequirementMinIntsText=Joomla.JText._("PLG_ELEMENT_PASSWORD_MIN_INTEGERS")+": "+this.pwMinInts,this.pwRequirementMinSymbolsText=Joomla.JText._("PLG_ELEMENT_PASSWORD_MIN_SYMBOLS")+": "+this.pwMinSymbols+" (one of: @$!%*#?&)",this.pwRequirementMinUppercaseText=Joomla.JText._("PLG_ELEMENT_PASSWORD_MIN_UPPERCASE")+": "+this.pwMinUppercase,this.pwRequirementMinLowercaseText=Joomla.JText._("PLG_ELEMENT_PASSWORD_MIN_LOWERCASE")+": "+this.pwMinLowercase,this.element&&this.element.addEvent("keyup",function(e){this.passwordChanged(e)}.bind(this)),!0===this.options.ajax_validation&&this.getConfirmationField().addEvent("blur",function(e){this.callvalidation(e)}.bind(this)),""===this.getConfirmationField().get("value")&&(this.getConfirmationField().value=this.element.value),Fabrik.addEvent("fabrik.form.doelementfx",function(t,n,s,i){if(t===this.form&&s===this.strElement)switch(n){case"disable":e(this.getConfirmationField()).prop("disabled",!0);break;case"enable":e(this.getConfirmationField()).prop("disabled",!1);break;case"readonly":e(this.getConfirmationField()).prop("readonly",!0);break;case"notreadonly":e(this.getConfirmationField()).prop("readonly",!1)}}.bind(this))},callvalidation:function(e){this.form.doElementValidation(e,!1,"_check")},cloned:function(e){console.log("cloned"),this.parent(e),this.ini()},passwordChanged:function(){var t=this.element,n="";if("null"!==typeOf(this.pwRequirementsIndicator)){let e,s=0;for(t.value.length>=this.pwMinLen?n+=' '+this.pwRequirementMinLenText+"
":n+=' '+this.pwRequirementMinLenText+"
",s=0,e=new RegExp("[0-9]","g");e.test(t.value);)s++;for(s>=this.pwMinInts?n+=' '+this.pwRequirementMinIntsText+"
":n+=' '+this.pwRequirementMinIntsText+"
",s=0,e=new RegExp("[@$!%*#?&]","g");e.test(t.value);)s++;for(s>=this.pwMinSymbols?n+=' '+this.pwRequirementMinSymbolsText+"
":n+=' '+this.pwRequirementMinSymbolsText+"
",s=0,e=new RegExp("[A-Z]","g");e.test(t.value);)s++;for(s>=this.pwMinUppercase?n+=' '+this.pwRequirementMinUppercaseText+"
":n+=' '+this.pwRequirementMinUppercaseText+"
",s=0,e=new RegExp("[a-z]","g");e.test(t.value);)s++;s>=this.pwMinLowercase?n+=' '+this.pwRequirementMinLowercaseText+"":n+=' '+this.pwRequirementMinLowercaseText+"",this.pwRequirementsIndicator.set("html",n)}var s=this.getContainer().getElement(".strength");if("null"!==typeOf(s)){n="";var i=new RegExp("^(?=.{6,})(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*\\W).*$","g"),a=new RegExp("^(?=.{6,})(((?=.*[A-Z])(?=.*[a-z]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[a-z])(?=.*[0-9]))).*$","g"),o=new RegExp("(?=.{6,}).*","g");if(this.options.progressbar){var r,p="";i.test(t.value)?(p=Joomla.JText._("PLG_ELEMENT_PASSWORD_STRONG"),r=e(Fabrik.jLayouts["fabrik-progress-bar-strong"])):a.test(t.value)?(p=Joomla.JText._("PLG_ELEMENT_PASSWORD_MEDIUM"),r=e(Fabrik.jLayouts["fabrik-progress-bar-medium"])):o.test(t.value)?(p=Joomla.JText._("PLG_ELEMENT_PASSWORD_WEAK"),r=e(Fabrik.jLayouts["fabrik-progress-bar-weak"])):(p=Joomla.JText._("PLG_ELEMENT_PASSWORD_MORE_CHARACTERS"),r=e(Fabrik.jLayouts["fabrik-progress-bar-more"]));var l={title:p};e(r).tooltip(l),e(s).replaceWith(r)}else n=!1===o.test(t.value)?""+Joomla.JText._("PLG_ELEMENT_PASSWORD_MORE_CHARACTERS")+"":i.test(t.value)?''+Joomla.JText._("PLG_ELEMENT_PASSWORD_STRONG")+"":a.test(t.value)?''+Joomla.JText._("PLG_ELEMENT_PASSWORD_MEDIUM")+"":''+Joomla.JText._("PLG_ELEMENT_PASSWORD_WEAK")+"",s.set("html",n)}},getConfirmationField:function(){return this.getContainer().getElement("input[name*=check]")}}),window.FbPassword})); +define(["jquery","fab/element"],(function(e,n){return window.FbPassword=new Class({Extends:n,options:{progressbar:!1},initialize:function(e,n){this.parent(e,n),this.options.editable&&this.ini()},ini:function(){this.pwRequirementsIndicator=this.getContainer().getElement("#pw-requirements-indicator"),"null"===typeOf(this.pwRequirementsIndicator)&&console.log("Password requirements indicator not found in DOM!"),this.pwMinLen=Joomla.getOptions("passwordMinLength"),this.pwMinInts=Joomla.getOptions("passwordMinIntegers"),this.pwMinSymbols=Joomla.getOptions("passwordMinSymbols"),this.pwMinUppercase=Joomla.getOptions("passwordMinUppercase"),this.pwMinLowercase=Joomla.getOptions("passwordMinLowercase"),this.pwRequirementMinLenText=Joomla.JText._("PLG_ELEMENT_PASSWORD_MIN_LENGTH")+": "+this.pwMinLen,this.pwRequirementMinIntsText=Joomla.JText._("PLG_ELEMENT_PASSWORD_MIN_INTEGERS")+": "+this.pwMinInts,this.pwRequirementMinSymbolsText=Joomla.JText._("PLG_ELEMENT_PASSWORD_MIN_SYMBOLS")+": "+this.pwMinSymbols+" (: "+Joomla.JText._("PLG_ELEMENT_PASSWORD_ONE_OF")+" @$!%*#?&)",this.pwRequirementMinUppercaseText=Joomla.JText._("PLG_ELEMENT_PASSWORD_MIN_UPPERCASE")+": "+this.pwMinUppercase,this.pwRequirementMinLowercaseText=Joomla.JText._("PLG_ELEMENT_PASSWORD_MIN_LOWERCASE")+": "+this.pwMinLowercase,this.element&&this.element.addEvent("keyup",function(e){this.passwordChanged(e)}.bind(this)),!0===this.options.ajax_validation&&this.getConfirmationField().addEvent("blur",function(e){this.callvalidation(e)}.bind(this)),""===this.getConfirmationField().get("value")&&(this.getConfirmationField().value=this.element.value),this.getConfirmationField().addEvent("keyup",function(e){this.passwordChanged(e)}.bind(this)),Fabrik.addEvent("fabrik.form.doelementfx",function(n,t,s,i){if(n===this.form&&s===this.strElement)switch(t){case"disable":e(this.getConfirmationField()).prop("disabled",!0);break;case"enable":e(this.getConfirmationField()).prop("disabled",!1);break;case"readonly":e(this.getConfirmationField()).prop("readonly",!0);break;case"notreadonly":e(this.getConfirmationField()).prop("readonly",!1)}}.bind(this))},callvalidation:function(e){this.form.doElementValidation(e,!1,"_check")},cloned:function(e){console.log("cloned"),this.parent(e),this.ini()},passwordChanged:function(){var n=this.element,t=this.getConfirmationField(),s="";if("null"!==typeOf(this.pwRequirementsIndicator)){let e,i=0;for(n.value.length>=this.pwMinLen?s+=' '+this.pwRequirementMinLenText+"
":s+=' '+this.pwRequirementMinLenText+"
",i=0,e=new RegExp("[0-9]","g");e.test(n.value);)i++;for(i>=this.pwMinInts?s+=' '+this.pwRequirementMinIntsText+"
":s+=' '+this.pwRequirementMinIntsText+"
",i=0,e=new RegExp("[@$!%*#?&]","g");e.test(n.value);)i++;for(i>=this.pwMinSymbols?s+=' '+this.pwRequirementMinSymbolsText+"
":s+=' '+this.pwRequirementMinSymbolsText+"
",i=0,e=new RegExp("[A-Z]","g");e.test(n.value);)i++;for(i>=this.pwMinUppercase?s+=' '+this.pwRequirementMinUppercaseText+"
":s+=' '+this.pwRequirementMinUppercaseText+"
",i=0,e=new RegExp("[a-z]","g");e.test(n.value);)i++;i>=this.pwMinLowercase?s+=' '+this.pwRequirementMinLowercaseText+"
":s+=' '+this.pwRequirementMinLowercaseText+"
",""!=n.value&&t.value==n.value?s+=' '+Joomla.JText._("PLG_ELEMENT_PASSWORD_MATCH")+"":s+=' '+Joomla.JText._("PLG_ELEMENT_PASSWORD_DONT_MATCH")+"",this.pwRequirementsIndicator.set("html",s)}var i=this.getContainer().getElement(".strength");if("null"!==typeOf(i)){s="";var a=new RegExp("^(?=.{6,})(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*\\W).*$","g"),o=new RegExp("^(?=.{6,})(((?=.*[A-Z])(?=.*[a-z]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[a-z])(?=.*[0-9]))).*$","g"),r=new RegExp("(?=.{6,}).*","g");if(this.options.progressbar){var l,p="";a.test(n.value)?(p=Joomla.JText._("PLG_ELEMENT_PASSWORD_STRONG"),l=e(Fabrik.jLayouts["fabrik-progress-bar-strong"])):o.test(n.value)?(p=Joomla.JText._("PLG_ELEMENT_PASSWORD_MEDIUM"),l=e(Fabrik.jLayouts["fabrik-progress-bar-medium"])):r.test(n.value)?(p=Joomla.JText._("PLG_ELEMENT_PASSWORD_WEAK"),l=e(Fabrik.jLayouts["fabrik-progress-bar-weak"])):(p=Joomla.JText._("PLG_ELEMENT_PASSWORD_MORE_CHARACTERS"),l=e(Fabrik.jLayouts["fabrik-progress-bar-more"]));var c={title:p};e(l).tooltip(c),e(i).replaceWith(l)}else s=!1===r.test(n.value)?""+Joomla.JText._("PLG_ELEMENT_PASSWORD_MORE_CHARACTERS")+"":a.test(n.value)?''+Joomla.JText._("PLG_ELEMENT_PASSWORD_STRONG")+"":o.test(n.value)?''+Joomla.JText._("PLG_ELEMENT_PASSWORD_MEDIUM")+"":''+Joomla.JText._("PLG_ELEMENT_PASSWORD_WEAK")+"",i.set("html",s)}},getConfirmationField:function(){return this.getContainer().getElement("input[name*=check]")}}),window.FbPassword})); diff --git a/plugins/fabrik_element/password/password.js b/plugins/fabrik_element/password/password.js index 7e4bd5d38ab..92261f79641 100644 --- a/plugins/fabrik_element/password/password.js +++ b/plugins/fabrik_element/password/password.js @@ -36,7 +36,7 @@ define(['jquery', 'fab/element'], function (jQuery, FbElement) { this.pwRequirementMinLenText = Joomla.JText._('PLG_ELEMENT_PASSWORD_MIN_LENGTH') + ': ' + this.pwMinLen; this.pwRequirementMinIntsText = Joomla.JText._('PLG_ELEMENT_PASSWORD_MIN_INTEGERS') + ': ' + this.pwMinInts; - this.pwRequirementMinSymbolsText = Joomla.JText._('PLG_ELEMENT_PASSWORD_MIN_SYMBOLS') + ': ' + this.pwMinSymbols + ' (one of: @$!%*#?&)'; + this.pwRequirementMinSymbolsText = Joomla.JText._('PLG_ELEMENT_PASSWORD_MIN_SYMBOLS') + ': ' + this.pwMinSymbols + ' (: ' + Joomla.JText._('PLG_ELEMENT_PASSWORD_ONE_OF') + ' @$!%*#?&)'; this.pwRequirementMinUppercaseText = Joomla.JText._('PLG_ELEMENT_PASSWORD_MIN_UPPERCASE') + ': ' + this.pwMinUppercase; this.pwRequirementMinLowercaseText = Joomla.JText._('PLG_ELEMENT_PASSWORD_MIN_LOWERCASE') + ': ' + this.pwMinLowercase; @@ -54,6 +54,9 @@ define(['jquery', 'fab/element'], function (jQuery, FbElement) { if (this.getConfirmationField().get('value') === '') { this.getConfirmationField().value = this.element.value; } + this.getConfirmationField().addEvent('keyup', function (e) { + this.passwordChanged(e); + }.bind(this)); Fabrik.addEvent('fabrik.form.doelementfx', function(form, method, id, groupfx) { if (form === this.form && id === this.strElement) @@ -89,6 +92,7 @@ define(['jquery', 'fab/element'], function (jQuery, FbElement) { passwordChanged: function () { var pwd = this.element; + var pwd_check = this.getConfirmationField(); var html = ''; /* Update the password requirements indicator */ @@ -142,9 +146,16 @@ define(['jquery', 'fab/element'], function (jQuery, FbElement) { while(regexExpr.test(pwd.value)) count++; if (count >= this.pwMinLowercase) { - html += ' ' + this.pwRequirementMinLowercaseText + ''; + html += ' ' + this.pwRequirementMinLowercaseText + '
'; + } else { + html += ' ' + this.pwRequirementMinLowercaseText + '
'; + } + + // check if passwords match + if (pwd.value != '' && pwd_check.value == pwd.value) { + html += ' ' + Joomla.JText._('PLG_ELEMENT_PASSWORD_MATCH') + ''; } else { - html += ' ' + this.pwRequirementMinLowercaseText + ''; + html += ' ' + Joomla.JText._('PLG_ELEMENT_PASSWORD_DONT_MATCH') + ''; } this.pwRequirementsIndicator.set('html', html); diff --git a/plugins/fabrik_element/password/password.php b/plugins/fabrik_element/password/password.php index f9ec8f7bc18..806f1c60b88 100644 --- a/plugins/fabrik_element/password/password.php +++ b/plugins/fabrik_element/password/password.php @@ -296,6 +296,9 @@ public function elementJavascript($repeatCounter) JText::script('PLG_ELEMENT_PASSWORD_MIN_SYMBOLS'); JText::script('PLG_ELEMENT_PASSWORD_MIN_UPPERCASE'); JText::script('PLG_ELEMENT_PASSWORD_MIN_LOWERCASE'); + JText::script('PLG_ELEMENT_PASSWORD_MATCH'); + JText::script('PLG_ELEMENT_PASSWORD_DONT_MATCH'); + JText::script('PLG_ELEMENT_PASSWORD_ONE_OF'); return array('FbPassword', $id, $opts); } From fab5fcec35cdc4a51b3a81502b02418723fd8cda Mon Sep 17 00:00:00 2001 From: Moritz W Date: Wed, 12 Jan 2022 22:34:41 +0100 Subject: [PATCH 4/5] Fix a small mistake in the string concatination for the symbol requiements --- plugins/fabrik_element/password/password-min.js | 2 +- plugins/fabrik_element/password/password.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/fabrik_element/password/password-min.js b/plugins/fabrik_element/password/password-min.js index 9fbd9ef3602..741be231737 100644 --- a/plugins/fabrik_element/password/password-min.js +++ b/plugins/fabrik_element/password/password-min.js @@ -4,4 +4,4 @@ * @copyright: Copyright (C) 2005-2016 Media A-Team, Inc. - All rights reserved. * @license: GNU/GPL http://www.gnu.org/copyleft/gpl.html */ -define(["jquery","fab/element"],(function(e,n){return window.FbPassword=new Class({Extends:n,options:{progressbar:!1},initialize:function(e,n){this.parent(e,n),this.options.editable&&this.ini()},ini:function(){this.pwRequirementsIndicator=this.getContainer().getElement("#pw-requirements-indicator"),"null"===typeOf(this.pwRequirementsIndicator)&&console.log("Password requirements indicator not found in DOM!"),this.pwMinLen=Joomla.getOptions("passwordMinLength"),this.pwMinInts=Joomla.getOptions("passwordMinIntegers"),this.pwMinSymbols=Joomla.getOptions("passwordMinSymbols"),this.pwMinUppercase=Joomla.getOptions("passwordMinUppercase"),this.pwMinLowercase=Joomla.getOptions("passwordMinLowercase"),this.pwRequirementMinLenText=Joomla.JText._("PLG_ELEMENT_PASSWORD_MIN_LENGTH")+": "+this.pwMinLen,this.pwRequirementMinIntsText=Joomla.JText._("PLG_ELEMENT_PASSWORD_MIN_INTEGERS")+": "+this.pwMinInts,this.pwRequirementMinSymbolsText=Joomla.JText._("PLG_ELEMENT_PASSWORD_MIN_SYMBOLS")+": "+this.pwMinSymbols+" (: "+Joomla.JText._("PLG_ELEMENT_PASSWORD_ONE_OF")+" @$!%*#?&)",this.pwRequirementMinUppercaseText=Joomla.JText._("PLG_ELEMENT_PASSWORD_MIN_UPPERCASE")+": "+this.pwMinUppercase,this.pwRequirementMinLowercaseText=Joomla.JText._("PLG_ELEMENT_PASSWORD_MIN_LOWERCASE")+": "+this.pwMinLowercase,this.element&&this.element.addEvent("keyup",function(e){this.passwordChanged(e)}.bind(this)),!0===this.options.ajax_validation&&this.getConfirmationField().addEvent("blur",function(e){this.callvalidation(e)}.bind(this)),""===this.getConfirmationField().get("value")&&(this.getConfirmationField().value=this.element.value),this.getConfirmationField().addEvent("keyup",function(e){this.passwordChanged(e)}.bind(this)),Fabrik.addEvent("fabrik.form.doelementfx",function(n,t,s,i){if(n===this.form&&s===this.strElement)switch(t){case"disable":e(this.getConfirmationField()).prop("disabled",!0);break;case"enable":e(this.getConfirmationField()).prop("disabled",!1);break;case"readonly":e(this.getConfirmationField()).prop("readonly",!0);break;case"notreadonly":e(this.getConfirmationField()).prop("readonly",!1)}}.bind(this))},callvalidation:function(e){this.form.doElementValidation(e,!1,"_check")},cloned:function(e){console.log("cloned"),this.parent(e),this.ini()},passwordChanged:function(){var n=this.element,t=this.getConfirmationField(),s="";if("null"!==typeOf(this.pwRequirementsIndicator)){let e,i=0;for(n.value.length>=this.pwMinLen?s+=' '+this.pwRequirementMinLenText+"
":s+=' '+this.pwRequirementMinLenText+"
",i=0,e=new RegExp("[0-9]","g");e.test(n.value);)i++;for(i>=this.pwMinInts?s+=' '+this.pwRequirementMinIntsText+"
":s+=' '+this.pwRequirementMinIntsText+"
",i=0,e=new RegExp("[@$!%*#?&]","g");e.test(n.value);)i++;for(i>=this.pwMinSymbols?s+=' '+this.pwRequirementMinSymbolsText+"
":s+=' '+this.pwRequirementMinSymbolsText+"
",i=0,e=new RegExp("[A-Z]","g");e.test(n.value);)i++;for(i>=this.pwMinUppercase?s+=' '+this.pwRequirementMinUppercaseText+"
":s+=' '+this.pwRequirementMinUppercaseText+"
",i=0,e=new RegExp("[a-z]","g");e.test(n.value);)i++;i>=this.pwMinLowercase?s+=' '+this.pwRequirementMinLowercaseText+"
":s+=' '+this.pwRequirementMinLowercaseText+"
",""!=n.value&&t.value==n.value?s+=' '+Joomla.JText._("PLG_ELEMENT_PASSWORD_MATCH")+"":s+=' '+Joomla.JText._("PLG_ELEMENT_PASSWORD_DONT_MATCH")+"",this.pwRequirementsIndicator.set("html",s)}var i=this.getContainer().getElement(".strength");if("null"!==typeOf(i)){s="";var a=new RegExp("^(?=.{6,})(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*\\W).*$","g"),o=new RegExp("^(?=.{6,})(((?=.*[A-Z])(?=.*[a-z]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[a-z])(?=.*[0-9]))).*$","g"),r=new RegExp("(?=.{6,}).*","g");if(this.options.progressbar){var l,p="";a.test(n.value)?(p=Joomla.JText._("PLG_ELEMENT_PASSWORD_STRONG"),l=e(Fabrik.jLayouts["fabrik-progress-bar-strong"])):o.test(n.value)?(p=Joomla.JText._("PLG_ELEMENT_PASSWORD_MEDIUM"),l=e(Fabrik.jLayouts["fabrik-progress-bar-medium"])):r.test(n.value)?(p=Joomla.JText._("PLG_ELEMENT_PASSWORD_WEAK"),l=e(Fabrik.jLayouts["fabrik-progress-bar-weak"])):(p=Joomla.JText._("PLG_ELEMENT_PASSWORD_MORE_CHARACTERS"),l=e(Fabrik.jLayouts["fabrik-progress-bar-more"]));var c={title:p};e(l).tooltip(c),e(i).replaceWith(l)}else s=!1===r.test(n.value)?""+Joomla.JText._("PLG_ELEMENT_PASSWORD_MORE_CHARACTERS")+"":a.test(n.value)?''+Joomla.JText._("PLG_ELEMENT_PASSWORD_STRONG")+"":o.test(n.value)?''+Joomla.JText._("PLG_ELEMENT_PASSWORD_MEDIUM")+"":''+Joomla.JText._("PLG_ELEMENT_PASSWORD_WEAK")+"",i.set("html",s)}},getConfirmationField:function(){return this.getContainer().getElement("input[name*=check]")}}),window.FbPassword})); +define(["jquery","fab/element"],(function(e,n){return window.FbPassword=new Class({Extends:n,options:{progressbar:!1},initialize:function(e,n){this.parent(e,n),this.options.editable&&this.ini()},ini:function(){this.pwRequirementsIndicator=this.getContainer().getElement("#pw-requirements-indicator"),"null"===typeOf(this.pwRequirementsIndicator)&&console.log("Password requirements indicator not found in DOM!"),this.pwMinLen=Joomla.getOptions("passwordMinLength"),this.pwMinInts=Joomla.getOptions("passwordMinIntegers"),this.pwMinSymbols=Joomla.getOptions("passwordMinSymbols"),this.pwMinUppercase=Joomla.getOptions("passwordMinUppercase"),this.pwMinLowercase=Joomla.getOptions("passwordMinLowercase"),this.pwRequirementMinLenText=Joomla.JText._("PLG_ELEMENT_PASSWORD_MIN_LENGTH")+": "+this.pwMinLen,this.pwRequirementMinIntsText=Joomla.JText._("PLG_ELEMENT_PASSWORD_MIN_INTEGERS")+": "+this.pwMinInts,this.pwRequirementMinSymbolsText=Joomla.JText._("PLG_ELEMENT_PASSWORD_MIN_SYMBOLS")+": "+this.pwMinSymbols+" ("+Joomla.JText._("PLG_ELEMENT_PASSWORD_ONE_OF")+": @$!%*#?&)",this.pwRequirementMinUppercaseText=Joomla.JText._("PLG_ELEMENT_PASSWORD_MIN_UPPERCASE")+": "+this.pwMinUppercase,this.pwRequirementMinLowercaseText=Joomla.JText._("PLG_ELEMENT_PASSWORD_MIN_LOWERCASE")+": "+this.pwMinLowercase,this.element&&this.element.addEvent("keyup",function(e){this.passwordChanged(e)}.bind(this)),!0===this.options.ajax_validation&&this.getConfirmationField().addEvent("blur",function(e){this.callvalidation(e)}.bind(this)),""===this.getConfirmationField().get("value")&&(this.getConfirmationField().value=this.element.value),this.getConfirmationField().addEvent("keyup",function(e){this.passwordChanged(e)}.bind(this)),Fabrik.addEvent("fabrik.form.doelementfx",function(n,t,s,i){if(n===this.form&&s===this.strElement)switch(t){case"disable":e(this.getConfirmationField()).prop("disabled",!0);break;case"enable":e(this.getConfirmationField()).prop("disabled",!1);break;case"readonly":e(this.getConfirmationField()).prop("readonly",!0);break;case"notreadonly":e(this.getConfirmationField()).prop("readonly",!1)}}.bind(this))},callvalidation:function(e){this.form.doElementValidation(e,!1,"_check")},cloned:function(e){console.log("cloned"),this.parent(e),this.ini()},passwordChanged:function(){var n=this.element,t=this.getConfirmationField(),s="";if("null"!==typeOf(this.pwRequirementsIndicator)){let e,i=0;for(n.value.length>=this.pwMinLen?s+=' '+this.pwRequirementMinLenText+"
":s+=' '+this.pwRequirementMinLenText+"
",i=0,e=new RegExp("[0-9]","g");e.test(n.value);)i++;for(i>=this.pwMinInts?s+=' '+this.pwRequirementMinIntsText+"
":s+=' '+this.pwRequirementMinIntsText+"
",i=0,e=new RegExp("[@$!%*#?&]","g");e.test(n.value);)i++;for(i>=this.pwMinSymbols?s+=' '+this.pwRequirementMinSymbolsText+"
":s+=' '+this.pwRequirementMinSymbolsText+"
",i=0,e=new RegExp("[A-Z]","g");e.test(n.value);)i++;for(i>=this.pwMinUppercase?s+=' '+this.pwRequirementMinUppercaseText+"
":s+=' '+this.pwRequirementMinUppercaseText+"
",i=0,e=new RegExp("[a-z]","g");e.test(n.value);)i++;i>=this.pwMinLowercase?s+=' '+this.pwRequirementMinLowercaseText+"
":s+=' '+this.pwRequirementMinLowercaseText+"
",""!=n.value&&t.value==n.value?s+=' '+Joomla.JText._("PLG_ELEMENT_PASSWORD_MATCH")+"":s+=' '+Joomla.JText._("PLG_ELEMENT_PASSWORD_DONT_MATCH")+"",this.pwRequirementsIndicator.set("html",s)}var i=this.getContainer().getElement(".strength");if("null"!==typeOf(i)){s="";var a=new RegExp("^(?=.{6,})(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*\\W).*$","g"),o=new RegExp("^(?=.{6,})(((?=.*[A-Z])(?=.*[a-z]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[a-z])(?=.*[0-9]))).*$","g"),r=new RegExp("(?=.{6,}).*","g");if(this.options.progressbar){var l,p="";a.test(n.value)?(p=Joomla.JText._("PLG_ELEMENT_PASSWORD_STRONG"),l=e(Fabrik.jLayouts["fabrik-progress-bar-strong"])):o.test(n.value)?(p=Joomla.JText._("PLG_ELEMENT_PASSWORD_MEDIUM"),l=e(Fabrik.jLayouts["fabrik-progress-bar-medium"])):r.test(n.value)?(p=Joomla.JText._("PLG_ELEMENT_PASSWORD_WEAK"),l=e(Fabrik.jLayouts["fabrik-progress-bar-weak"])):(p=Joomla.JText._("PLG_ELEMENT_PASSWORD_MORE_CHARACTERS"),l=e(Fabrik.jLayouts["fabrik-progress-bar-more"]));var c={title:p};e(l).tooltip(c),e(i).replaceWith(l)}else s=!1===r.test(n.value)?""+Joomla.JText._("PLG_ELEMENT_PASSWORD_MORE_CHARACTERS")+"":a.test(n.value)?''+Joomla.JText._("PLG_ELEMENT_PASSWORD_STRONG")+"":o.test(n.value)?''+Joomla.JText._("PLG_ELEMENT_PASSWORD_MEDIUM")+"":''+Joomla.JText._("PLG_ELEMENT_PASSWORD_WEAK")+"",i.set("html",s)}},getConfirmationField:function(){return this.getContainer().getElement("input[name*=check]")}}),window.FbPassword})); diff --git a/plugins/fabrik_element/password/password.js b/plugins/fabrik_element/password/password.js index 92261f79641..b7fb4334e12 100644 --- a/plugins/fabrik_element/password/password.js +++ b/plugins/fabrik_element/password/password.js @@ -36,7 +36,7 @@ define(['jquery', 'fab/element'], function (jQuery, FbElement) { this.pwRequirementMinLenText = Joomla.JText._('PLG_ELEMENT_PASSWORD_MIN_LENGTH') + ': ' + this.pwMinLen; this.pwRequirementMinIntsText = Joomla.JText._('PLG_ELEMENT_PASSWORD_MIN_INTEGERS') + ': ' + this.pwMinInts; - this.pwRequirementMinSymbolsText = Joomla.JText._('PLG_ELEMENT_PASSWORD_MIN_SYMBOLS') + ': ' + this.pwMinSymbols + ' (: ' + Joomla.JText._('PLG_ELEMENT_PASSWORD_ONE_OF') + ' @$!%*#?&)'; + this.pwRequirementMinSymbolsText = Joomla.JText._('PLG_ELEMENT_PASSWORD_MIN_SYMBOLS') + ': ' + this.pwMinSymbols + ' (' + Joomla.JText._('PLG_ELEMENT_PASSWORD_ONE_OF') + ': @$!%*#?&)'; this.pwRequirementMinUppercaseText = Joomla.JText._('PLG_ELEMENT_PASSWORD_MIN_UPPERCASE') + ': ' + this.pwMinUppercase; this.pwRequirementMinLowercaseText = Joomla.JText._('PLG_ELEMENT_PASSWORD_MIN_LOWERCASE') + ': ' + this.pwMinLowercase; From a1b7bb5bff73ca25e0a096519a54f9016c09026c Mon Sep 17 00:00:00 2001 From: Moritz W Date: Wed, 12 Jan 2022 22:36:12 +0100 Subject: [PATCH 5/5] Add the french translations for the password requirements indicator --- .../fr-FR.plg_fabrik_element_password.ini | 55 +++++++++++-------- 1 file changed, 33 insertions(+), 22 deletions(-) diff --git a/plugins/fabrik_element/password/language/fr-FR/fr-FR.plg_fabrik_element_password.ini b/plugins/fabrik_element/password/language/fr-FR/fr-FR.plg_fabrik_element_password.ini index 9b0b15fa0ea..06a3c852cc7 100644 --- a/plugins/fabrik_element/password/language/fr-FR/fr-FR.plg_fabrik_element_password.ini +++ b/plugins/fabrik_element/password/language/fr-FR/fr-FR.plg_fabrik_element_password.ini @@ -1,22 +1,33 @@ -; Fabrik 3 -; Copyright (C) 2005-2016 Media A-Team, Inc. - All rights reserved. -; License GNU/GPL http://www.gnu.org/copyleft/gpl.html -; Note : All ini files need to be saved as UTF-8 - No BOM - -PLG_ELEMENT_PASSWORD_MAXLENGTH_LABEL="Longueur du champ" - -PLG_ELEMENT_PASSWORD_STRONG="Solide" -PLG_ELEMENT_PASSWORD_MEDIUM="Moyen" -PLG_ELEMENT_PASSWORD_WEAK="Faible" -PLG_ELEMENT_PASSWORD_TYPE_PASSWORD="Tapez votre mot de passe" -PLG_ELEMENT_PASSWORD_MORE_CHARACTERS="Plus de caractères" -PLG_ELEMENT_PASSWORD_CONFIRM_PASSWORD="Confirmez le mot de passe" -PLG_ELEMENT_PASSWORD_PASSWORD_CONFIRMATION_DOES_NOT_MATCH="La confirmation du mot de passe ne correspond pas" -PLG_ELEMENT_PASSWORD_PASSWORD_CONFIRMATION_EMPTY_NOT_ALLOWED="Vous devez entrer un mot de passe" -PLG_ELEMENT_PASSWORD_SHOW_STRENGTH_METER_DESC="Une jauge doit-elle être affichée pour indiquer la force du mot de passe" -PLG_ELEMENT_PASSWORD_SHOW_STRENGTH_METER_LABEL="Montrer la force du mot de passe" -PLG_ELEMENT_PASSWORD_JRULE_VALIDATION_DESC="Si réglé sur 'Oui', le mot de passe sera évalué selon les options du composant com_users. Dans ces optioons vous pouvez, par exemple, fixer le nombre d'entiers ou de symbôles requis dans le mot de passe" -PLG_ELEMENT_PASSWORD_JRULE_VALIDATION_LABEL="Validation du mot de passe Joomla" - -;Front end -PLG_ELEMENT_PASSWORD_VALIDATION_TIP="Veuillez taper un mot de passe et vérifier que la confirmation est la même" +; Fabrik 3 +; Copyright (C) 2005-2016 Media A-Team, Inc. - All rights reserved. +; License GNU/GPL http://www.gnu.org/copyleft/gpl.html +; Note : All ini files need to be saved as UTF-8 - No BOM + +PLG_ELEMENT_PASSWORD_MAXLENGTH_LABEL="Longueur du champ" + +PLG_ELEMENT_PASSWORD_STRONG="Solide" +PLG_ELEMENT_PASSWORD_MEDIUM="Moyen" +PLG_ELEMENT_PASSWORD_WEAK="Faible" +PLG_ELEMENT_PASSWORD_TYPE_PASSWORD="Tapez votre mot de passe" +PLG_ELEMENT_PASSWORD_MORE_CHARACTERS="Plus de caractères" +PLG_ELEMENT_PASSWORD_CONFIRM_PASSWORD="Confirmez le mot de passe" +PLG_ELEMENT_PASSWORD_PASSWORD_CONFIRMATION_DOES_NOT_MATCH="La confirmation du mot de passe ne correspond pas" +PLG_ELEMENT_PASSWORD_PASSWORD_CONFIRMATION_EMPTY_NOT_ALLOWED="Vous devez entrer un mot de passe" +PLG_ELEMENT_PASSWORD_SHOW_STRENGTH_METER_DESC="Une jauge doit-elle être affichée pour indiquer la force du mot de passe" +PLG_ELEMENT_PASSWORD_SHOW_STRENGTH_METER_LABEL="Montrer la force du mot de passe" +PLG_ELEMENT_PASSWORD_JRULE_VALIDATION_DESC="Si réglé sur 'Oui', le mot de passe sera évalué selon les options du composant com_users. Dans ces optioons vous pouvez, par exemple, fixer le nombre d'entiers ou de symbôles requis dans le mot de passe" +PLG_ELEMENT_PASSWORD_JRULE_VALIDATION_LABEL="Validation du mot de passe Joomla" +; Password requirements check +PLG_ELEMENT_PASSWORD_SHOW_REQUIREMENTS_DESC="Should a box be shown that indicates which Joomla password requirements are fulfilled" +PLG_ELEMENT_PASSWORD_SHOW_REQUIREMENTS_LABEL="Afficher les exigences relatives au mot de passe de Joomla" +PLG_ELEMENT_PASSWORD_MIN_LENGTH="Longueur minimale du mot de passe" +PLG_ELEMENT_PASSWORD_MIN_INTEGERS="Nombre de chiffres" +PLG_ELEMENT_PASSWORD_MIN_SYMBOLS="Nombre de symboles" +PLG_ELEMENT_PASSWORD_MIN_UPPERCASE="Caractères majuscules" +PLG_ELEMENT_PASSWORD_MIN_LOWERCASE="Caractères minuscules" +PLG_ELEMENT_PASSWORD_ONE_OF="un de" +PLG_ELEMENT_PASSWORD_MATCH="Les mots de passe correspondent" +PLG_ELEMENT_PASSWORD_DONT_MATCH="Les mots de passe ne correspondent pas" + +;Front end +PLG_ELEMENT_PASSWORD_VALIDATION_TIP="Veuillez taper un mot de passe et vérifier que la confirmation est la même"