Fix install alert msg not showed, pw confirm id + js errors lang

js #retype-password to #password-confirm
This commit is contained in:
Thomas Ingles 2024-04-30 14:25:25 +02:00
parent 2bc5c5a360
commit c81ba8da21
No known key found for this signature in database
GPG key ID: 02A5671B95EAD354
2 changed files with 10 additions and 10 deletions

View file

@ -39,7 +39,7 @@
</details></p>
</div>
<div class="alert d-none"></div>
<div class="alert" hidden></div>
<div class="row">
<div class="admin-settings col-12 col-sm-5">

View file

@ -25,7 +25,7 @@ App.Pages.Installation = (function () {
const $phoneNumber = $('#phone-number');
const $username = $('#username');
const $password = $('#password');
const $retypePassword = $('#retype-password');
const $passwordConfirm = $('#password-confirm');
const $companyName = $('#company-name');
const $companyEmail = $('#company-email');
const $companyLink = $('#company-link');
@ -97,31 +97,31 @@ App.Pages.Installation = (function () {
});
if (missingRequired) {
throw new Error('All the page fields are required.');
throw new Error(lang('fields_are_required'));
}
// Validate Passwords
if ($password.val() !== $retypePassword.val()) {
if ($password.val() !== $passwordConfirm.val()) {
$password.addClass('is-invalid');
$retypePassword.addClass('is-invalid');
throw new Error('Passwords do not match!');
$passwordConfirm.addClass('is-invalid');
throw new Error(lang('passwords_mismatch'));
}
if ($password.val().length < MIN_PASSWORD_LENGTH) {
$password.addClass('is-invalid');
$retypePassword.addClass('is-invalid');
throw new Error(`The password must be at least ${MIN_PASSWORD_LENGTH} characters long.`);
$passwordConfirm.addClass('is-invalid');
throw new Error(lang('password_length_notice').replace('$number', MIN_PASSWORD_LENGTH));
}
// Validate Email
if (!App.Utils.Validation.email($email.val())) {
$email.addClass('is-invalid');
throw new Error('The email address is invalid!');
throw new Error(lang('invalid_email'));
}
if (!App.Utils.Validation.email($companyEmail.val())) {
$companyEmail.addClass('is-invalid');
throw new Error('The email address is invalid!');
throw new Error(lang('invalid_email'));
}
return true;