diff --git a/assets/js/deleteConfirm.js b/assets/js/deleteConfirm.js index b4d41f7..8ce89d2 100644 --- a/assets/js/deleteConfirm.js +++ b/assets/js/deleteConfirm.js @@ -3,10 +3,11 @@ * CompluCine - FDI-cines */ -function confirmDelete() { +function confirmDelete(e) { if(confirm("¿Está seguro de que desea eliminar su cuenta de usuario?\nEsta acción no se puede deshacer.")){ - document.formDeleteAccount.submit(); + document.getElementById("formDeleteAccount1").submit(); } else { - location.href = "./"; + //location.href = "./"; + e.preventDefault(); } } \ No newline at end of file diff --git a/assets/js/selectTicket.js b/assets/js/selectTicket.js index b04ee79..1de59c9 100644 --- a/assets/js/selectTicket.js +++ b/assets/js/selectTicket.js @@ -5,17 +5,30 @@ // Método 1: recargar la página y enviar un GET. window.onload = function(){ + if(!select_cinema()) select_film(); +} + +function select_cinema(){ var select = document.getElementById("select_cinema"); - select.onchange = function(){ - location.href += "&cinema=" + $('select[id=cinemas]').val(); + console.log(select); + if(select != undefined){ + select.onchange = function(){ + location.href += "&cinema=" + $('select[id=cinemas]').val(); + } + return true; + } else { + return false; } } -var select_ = document.getElementById("select_film"); -select_.onchange = function(){ - location.href += "&film=" + $('select[id=films]').val(); +function select_film(){ + var select_ = document.getElementById("select_film"); + select_.onchange = function(){ + location.href += "&film=" + $('select[id=films]').val(); + } } + // Método 2: enviar una petición AJAX con POST. ==> (NO FUNCIONA, PERO LA IDEA ERA HACERLO ASÍ PARA EVITAR REFRESCAR LA PÁGINA Y LLENAR LA URL) /* $(document).ready(function(){ diff --git a/panel_user/includes/formDeleteAccount.php b/panel_user/includes/formDeleteAccount.php index fb3aff0..2176aa8 100644 --- a/panel_user/includes/formDeleteAccount.php +++ b/panel_user/includes/formDeleteAccount.php @@ -22,9 +22,10 @@ class FormDeleteAccount extends Form { $errorEmail = self::createMensajeError($errores, 'email', 'span', array('class' => 'error')); $errorPassword = self::createMensajeError($errores, 'pass', 'span', array('class' => 'error')); $errorPassword2 = self::createMensajeError($errores, 'repass', 'span', array('class' => 'error')); + $errorVerify = self::createMensajeError($errores, 'verify', 'span', array('class' => 'error')); $html = "
-
".$htmlErroresGlobales."
+
".$htmlErroresGlobales."
".$errorVerify."
Datos de la cuenta
".$errorNombre."
".$errorEmail."
@@ -38,7 +39,7 @@ class FormDeleteAccount extends Form {
- +
"; @@ -67,6 +68,11 @@ class FormDeleteAccount extends Form { if ( empty($password2) || strcmp($password, $password2) !== 0 ) { $result['repass'] = "Los passwords deben coincidir."; } + + $verify = $this->test_input($datos['verify']) ?? null; + if ( empty($verify) ) { + $result['verify'] = "Debe confirmar la casilla de verificación."; + } if (count($result) === 0) { $bd = new UserDAO("complucine"); @@ -77,15 +83,10 @@ class FormDeleteAccount extends Form { if( (unserialize($_SESSION['user'])->getId() === $user->getId()) && ($nombre === $user->getName()) && ($email === $user->getEmail()) && ($bd->verifyPass($password, $user->getPass())) ){ - if(!isset($_GET['reply'])){ $bd->deleteUserAccount($user->getId()); unset($_SESSION); session_destroy(); - $result = ROUTE_APP; - } else { - $result[] = "Operación cancelada."; - } } else { $result[] = "Los datos introducidos\nno son válidos."; diff --git a/register/includes/formRegister.php b/register/includes/formRegister.php index e3fdc3f..689ac6b 100644 --- a/register/includes/formRegister.php +++ b/register/includes/formRegister.php @@ -26,6 +26,7 @@ class FormRegister extends Form { $errorEmail = self::createMensajeError($errores, 'new_email', 'span', array('class' => 'error')); $errorPassword = self::createMensajeError($errores, 'new_pass', 'span', array('class' => 'error')); $errorPassword2 = self::createMensajeError($errores, 'repass', 'span', array('class' => 'error')); + $errorVerify = self::createMensajeError($errores, 'terms', 'span', array('class' => 'error')); $html = "
".$htmlErroresGlobales."
@@ -39,7 +40,7 @@ class FormRegister extends Form {
".$errorPassword2."
-
+ @@ -58,7 +59,7 @@ class FormRegister extends Form { $nombre = $this->test_input($datos['new_name']) ?? null; $nombre = strtolower($nombre); if ( empty($nombre) || mb_strlen($nombre) < 3 || mb_strlen($nombre) > 15 ) { - $result['new_name'] = "El nombre tiene que tener\n una longitud de al menos\n 3 caracteres\n y menos de 15 caracteres."; + $result['new_name'] = "El nombre tiene que tener\nuna longitud de al menos\n3 caracteres\ny menos de 15 caracteres."; } $email = $this->test_input($datos['new_email']) ?? null; @@ -68,12 +69,17 @@ class FormRegister extends Form { $password = $this->test_input($datos['new_pass']) ?? null; if ( empty($password) || !mb_ereg_match(self::HTML5_PASS_REGEXP, $password) ) { - $result['new_pass'] = "El password tiene que tener\n una longitud de al menos\n 4 caracteres 1 mayúscula y 1 número."; + $result['new_pass'] = "El password tiene que tener\nuna longitud de al menos\n 4 caracteres 1 mayúscula y 1 número."; } $password2 = $this->test_input($datos['repass']) ?? null; if ( empty($password2) || strcmp($password, $password2) !== 0 ) { $result['repass'] = "Los passwords deben coincidir"; } + + $verify = $this->test_input($datos['terms']) ?? null; + if ( empty($verify) ) { + $result['terms'] = "Debe confirmar la casilla de\ntérminos y condiciones."; + } if (count($result) === 0) { $bd = new UserDAO('complucine');