From f11d777519669bb2405c7cae293b0475812e01e4 Mon Sep 17 00:00:00 2001 From: DelfinaAricoma Date: Mon, 16 Oct 2023 17:48:14 -0300 Subject: [PATCH] =?UTF-8?q?A=C3=B1adi=20roles(un=20administrador=20y=20un?= =?UTF-8?q?=20usuario)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ricco/frontend/assets/js/adm.js | 2 +- ricco/frontend/assets/js/login2.js | 34 ++++++++++++++++++++++++----- ricco/frontend/index.html | 1 + ricco/frontend/pages/login.html | 3 ++- ricco/frontend/pages/productos.html | 2 +- ricco/frontend/pages/registro.html | 4 ++-- 6 files changed, 36 insertions(+), 10 deletions(-) diff --git a/ricco/frontend/assets/js/adm.js b/ricco/frontend/assets/js/adm.js index 5ac34d68..7f50e35f 100644 --- a/ricco/frontend/assets/js/adm.js +++ b/ricco/frontend/assets/js/adm.js @@ -83,4 +83,4 @@ document.querySelector("#productos-list").addEventListener("click",(e)=>{ target.parentElement.parentElement.remove(); showAlert("El producto fue eliminado correctamente", "danger"); } -}); \ No newline at end of file +}); diff --git a/ricco/frontend/assets/js/login2.js b/ricco/frontend/assets/js/login2.js index 7a0146cb..a951d338 100644 --- a/ricco/frontend/assets/js/login2.js +++ b/ricco/frontend/assets/js/login2.js @@ -30,16 +30,40 @@ document.addEventListener('DOMContentLoaded', function() { } + /*Roles: + 1:Administrador + 2:Cliente */ + + var listUsers= + [//nombre apellido correo contraseña rol + ['NombreAdm1','ApellidoAdm1','administrador@gmail.com','1234Admi','1'], + ['NombreCliente1','ApellidoCliente1','cliente@gmail.com','1234Cliente','2'] + ]; + + + + + emailInput.addEventListener('input', validarEmail); contrasenaInput.addEventListener('input', validarContrasena); submitButton.addEventListener('click', function(event) { - if (emailRegExpression.test(emailInput.value) && passwordRegExpression.test(contrasenaInput.value)) { - emailInput.value = ''; - contrasenaInput.value = ''; - mensajeError.textContent = ''; - window.location= "https://g10-ispc.github.io/IntegradorFullStack-G10/ricco/frontend/index.html"; + if (emailRegExpression.test(emailInput.value) && passwordRegExpression.test(contrasenaInput.value) ) { + if (emailInput.value==listUsers[0][2] && contrasenaInput.value==listUsers[0][3] && listUsers[0][4]=="1"){ + window.location= "administrador.html"; + window.alert('¡Bienvenido Administrador!'); + } + if(emailInput.value==listUsers[1][2] && contrasenaInput.value==listUsers[1][3] && listUsers[1][4]=="2") { + window.location= "../index.html"; + window.alert('Ricco Burgers valora a cada uno de sus clientes, ¡Bienvenido!'); + } + else{ + mensajeError.textContent = 'Su correo no posee una cuenta, debe registrarse.';} + //emailInput.value = ''; + //contrasenaInput.value = ''; + //mensajeError.textContent = ''; + } else { event.preventDefault(); mensajeError.textContent = 'E-mail o contraseña incorrecta.'; diff --git a/ricco/frontend/index.html b/ricco/frontend/index.html index 6a80dcf3..27daca1a 100644 --- a/ricco/frontend/index.html +++ b/ricco/frontend/index.html @@ -253,5 +253,6 @@

NUESTRO ESPACIO

integrity="sha384-ENjdO4Dr2bkBIFxQpeoTz1HIcje39Wm4jDKdf19U8gI4ddQ3GYNS7NTKfAdVQSZe" crossorigin="anonymous" > + diff --git a/ricco/frontend/pages/login.html b/ricco/frontend/pages/login.html index 49cf712e..d2f2f969 100644 --- a/ricco/frontend/pages/login.html +++ b/ricco/frontend/pages/login.html @@ -11,7 +11,8 @@ rel="stylesheet" integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ" crossorigin="anonymous"> - LOGIN Y REGISTRO RICCO + + RICCO BURGERS
diff --git a/ricco/frontend/pages/productos.html b/ricco/frontend/pages/productos.html index 87f26bd0..3b8c07f8 100644 --- a/ricco/frontend/pages/productos.html +++ b/ricco/frontend/pages/productos.html @@ -55,7 +55,7 @@