From e2e366eeee3d4fca43920bd1d1ac534060afd43d Mon Sep 17 00:00:00 2001 From: Thomas Ingles Date: Wed, 24 Apr 2024 22:31:32 +0200 Subject: [PATCH] Fix untranslated secretaries + providers js (errors) Fix provider : MIN_PASSWORD_LENGTH is undefined A constant in php :) --- assets/js/pages/providers.js | 2 +- assets/js/pages/secretaries.js | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/assets/js/pages/providers.js b/assets/js/pages/providers.js index 6d284e17..e821baca 100755 --- a/assets/js/pages/providers.js +++ b/assets/js/pages/providers.js @@ -288,7 +288,7 @@ App.Pages.Providers = (function () { if ($password.val().length < vars('min_password_length') && $password.val() !== '') { $('#password, #password-confirm').addClass('is-invalid'); - throw new Error(lang('password_length_notice').replace('$number', MIN_PASSWORD_LENGTH)); + throw new Error(lang('password_length_notice').replace('$number', vars('min_password_length'))); } // Validate user email. diff --git a/assets/js/pages/secretaries.js b/assets/js/pages/secretaries.js index 75e85a83..4fd39215 100644 --- a/assets/js/pages/secretaries.js +++ b/assets/js/pages/secretaries.js @@ -285,24 +285,24 @@ App.Pages.Secretaries = (function () { } }); if (missingRequired) { - throw new Error('Fields with * are required.'); + throw new Error(lang('fields_are_required')); } // Validate passwords. if ($password.val() !== $passwordConfirmation.val()) { $('#password, #password-confirm').addClass('is-invalid'); - throw new Error('Passwords mismatch!'); + throw new Error(lang('passwords_mismatch')); } if ($password.val().length < vars('min_password_length') && $password.val() !== '') { $('#password, #password-confirm').addClass('is-invalid'); - throw new Error('Password must be at least ' + vars('min_password_length') + ' characters long.'); + throw new Error(lang('password_length_notice').replace('$number', vars('min_password_length'))); } // Validate user email. if (!App.Utils.Validation.email($email.val())) { $email.addClass('is-invalid'); - throw new Error('Invalid email address!'); + throw new Error(lang('invalid_email')); } // Validate phone number. @@ -324,7 +324,7 @@ App.Pages.Secretaries = (function () { // Check if username exists if ($username.attr('already-exists') === 'true') { $username.addClass('is-invalid'); - throw new Error('Username already exists.'); + throw new Error(lang('username_already_exists')); } return true;