Skip to content

Commit

Permalink
Merge pull request #83 from G10-ISPC/DelfinaAricoma
Browse files Browse the repository at this point in the history
Añadi roles(un administrador y un usuario)
  • Loading branch information
DelfinaDAM authored Oct 16, 2023
2 parents d2b0016 + f11d777 commit 8bd8eda
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 10 deletions.
2 changes: 1 addition & 1 deletion ricco/frontend/assets/js/adm.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@ document.querySelector("#productos-list").addEventListener("click",(e)=>{
target.parentElement.parentElement.remove();
showAlert("El producto fue eliminado correctamente", "danger");
}
});
});
34 changes: 29 additions & 5 deletions ricco/frontend/assets/js/login2.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,40 @@ document.addEventListener('DOMContentLoaded', function() {
}


/*Roles:
1:Administrador
2:Cliente */

var listUsers=
[//nombre apellido correo contraseña rol
['NombreAdm1','ApellidoAdm1','[email protected]','1234Admi','1'],
['NombreCliente1','ApellidoCliente1','[email protected]','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.';
Expand Down
1 change: 1 addition & 0 deletions ricco/frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -253,5 +253,6 @@ <h2 class="text-light">NUESTRO ESPACIO</h2>
integrity="sha384-ENjdO4Dr2bkBIFxQpeoTz1HIcje39Wm4jDKdf19U8gI4ddQ3GYNS7NTKfAdVQSZe"
crossorigin="anonymous"
></script>
<script src="../assets/js/login2.js"></script>
</body>
</html>
3 changes: 2 additions & 1 deletion ricco/frontend/pages/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
rel="stylesheet"
integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ"
crossorigin="anonymous">
<title>LOGIN Y REGISTRO RICCO</title>
<link rel="icon" href="../assets/img/favicon.ico">
<title>RICCO BURGERS</title>
</head>
<body>
<header>
Expand Down
2 changes: 1 addition & 1 deletion ricco/frontend/pages/productos.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<main>
<section>
<div class="container__card">
<div id="adms" ><!--style="display:none" una vez definida la validacion de roles-->
<div id="administrador" style="display:none" ><!--" una vez definida la validacion de roles-->
<a href="administrador.html">
<div class="card">
<div class="card__front"
Expand Down
4 changes: 2 additions & 2 deletions ricco/frontend/pages/registro.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
crossorigin="anonymous"
></script>
<link rel="stylesheet" href="../assets/css/login.css">
<link rel="icon" href="../img/favicon.ico">
<link rel="icon" href="../assets/img/favicon.ico">
<title>RICCO BURGERS</title>
</head>
<body>
Expand Down Expand Up @@ -44,7 +44,7 @@
<a class="nav-link text-light" href="../index.html">Home</a>
<a class="nav-link text-light" href="productos.html">Productos</a>
<a class="nav-link text-light" href="nosotros.html">Nosotros</a>
<a class="nav-link text-light" href="login.html"><i class="fa-solid fa-circle-user fa-2xl"></i> Iniciar sesión</a>
<a class="nav-link text-light" href="login.html"><i class="fa-solid fa-circle-user fa-2xl"></i></a>
</div>
</div>
</div>
Expand Down

0 comments on commit 8bd8eda

Please sign in to comment.