diff --git a/assets/js/checkForms.js b/assets/js/checkForms.js index fc21fce..4ae73d4 100644 --- a/assets/js/checkForms.js +++ b/assets/js/checkForms.js @@ -21,6 +21,10 @@ $(document).ready(function() { $("#passValid").hide(); $("#passInvalid").hide(); $("#passWarning").hide(); + + //Iconos para validar que las contraseñas coindicen: + $("#repassValid").hide(); + $("#repassInvalid").hide(); //Comprueba que el nombre de usuario introducido para el login, exista. $("#name").change(function(){ @@ -66,6 +70,24 @@ $(document).ready(function() { }); + //Comprueba que las contraseñas sean iguales. + $("#repass").change(function(){ + const fieldPass = $("#new_pass"); + const fieldRepass = $("#repass"); + fieldRepass[0].setCustomValidity(""); + + if (Object.is(fieldPass.val(), fieldRepass.val())) { + $("#repassValid").show(); + $("#repassInvalid").hide(); + fieldRepass[0].setCustomValidity(""); + } else { + $("#repassValid").hide(); + $("#repassInvalid").show(); + fieldRepass[0].setCustomValidity("Las contraseñas deben coincidir."); + } + + }); + //Muestra si el nombre de usuario introducido para el login existe o no. function userLoginCheck(data, status) { const fieldLogin = $("#name"); diff --git a/panel_user/includes/formChangePass.php b/panel_user/includes/formChangePass.php index c7e3bfb..ad4e1bd 100644 --- a/panel_user/includes/formChangePass.php +++ b/panel_user/includes/formChangePass.php @@ -26,6 +26,7 @@ class FormChangePass extends Form {
".$errorPassword."
".$errorPassword2."
+
diff --git a/panel_user/includes/formDeleteAccount.php b/panel_user/includes/formDeleteAccount.php index 95840f3..077a583 100644 --- a/panel_user/includes/formDeleteAccount.php +++ b/panel_user/includes/formDeleteAccount.php @@ -27,8 +27,9 @@ class FormDeleteAccount extends Form { Datos de la cuenta
".$errorNombre."
".$errorEmail."
-
".$errorPassword."
+
".$errorPassword."
".$errorPassword2."
+
diff --git a/register/includes/formRegister.php b/register/includes/formRegister.php index f01c7cc..092f6ed 100644 --- a/register/includes/formRegister.php +++ b/register/includes/formRegister.php @@ -38,6 +38,7 @@ class FormRegister extends Form {
".$errorPassword."
".$errorPassword2."
+