Skip to content

Commit 3f79f7a

Browse files
committed
20240608-ENTREGA 2 TERMINADA
1 parent 6960c3b commit 3f79f7a

File tree

6 files changed

+181
-5
lines changed

6 files changed

+181
-5
lines changed

Entregas/Entrega2/busqueda.html

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<link rel="stylesheet" href="./estilos.css" type="text/css">
7+
<script async src="./registro.js"></script>
8+
<title>ENTREGA 02</title>
9+
</head>
10+
11+
<body>
12+
13+
<div id="contenedor">
14+
<div id="central">
15+
<div id="login">
16+
<div class="titulo">
17+
BUSQUEDA DE EQUIPOS <BR> (DATOS DESDE BASE DE DATOS)
18+
<div class="inferior">
19+
<a href="./index.html">Inicio</a>
20+
</div>
21+
</div>
22+
</div>
23+
</body>
24+
</html>

Entregas/Entrega2/estilos.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ p {
4848
width: 100%;
4949
}
5050

51-
.titulo {
51+
.login {
5252
font-size: 200%;
5353
color:#bbe1fa;
5454
text-align: center;

Entregas/Entrega2/index - copia.js

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
2+
/**
3+
* CLASE CON METODOS PARA REGISTRO Y ACCESO
4+
*/
5+
6+
class User {
7+
constructor(nombre, apellido, cedula, usuario,pass){
8+
this.nombre= nombre;
9+
this.apellido= apellido;
10+
this.cedula= cedula;
11+
this.usuario= usuario;
12+
this.pass=pass ;
13+
this.datosU={
14+
nombre: this.nombre,
15+
apellido: this.apellido,
16+
cedula:this.cedula,
17+
usuario: this.usuario,
18+
pass: this.pass
19+
}
20+
}
21+
22+
ingresoDatos (){
23+
/**
24+
* USANDO PROMPT Y VARIABLES SIMPLES PARA INGRESO DE DATOS
25+
*/
26+
// this.nombre=prompt("Ingrese Nombre: ");
27+
// this.apellido=prompt("Ingrese Apellido: ");
28+
// this.cedula=prompt("Ingrese Cedula: ");
29+
// this.usuario=prompt("Ingrese Usuario: ");
30+
// this.pass=prompt("Ingrese Password: ");
31+
// this.datosU=[{
32+
// nombre: this.nombre,
33+
// apellido: this.apellido,
34+
// cedula:this.cedula,
35+
// usuario: this.usuario,
36+
// pass: this.pass
37+
// }]
38+
/**
39+
* USANDO OBJETO y FOR..IN PARA INGRESO DE DATOS
40+
*/
41+
const datosU={
42+
nombre: this.nombre,
43+
apellido: this.apellido,
44+
cedula:this.cedula,
45+
usuario: this.usuario,
46+
pass: this.pass
47+
}
48+
for (const property in datosU) {
49+
datosU[property] = prompt('Ingrese '+property+': ');
50+
}
51+
console.log(datosU);
52+
return this.datosU=datosU;
53+
}
54+
55+
login (){
56+
let x=true; let y=true;
57+
console.log("DENTRO DEL LOGIN: "+ this.usuario);//LINEA PARA VERIFICACION EN CONSOLA
58+
if(this.datosU.usuario===null){
59+
alert("DEBE REGISTRAR USUARIO");
60+
this.ingresoDatos();
61+
}
62+
while (x) {
63+
console.log("USUARIO en WHILE(x): "+this.pass);//LINEA PARA VERIFICACION EN CONSOLA
64+
let user=prompt("INGRESE USUARIO O X PARA SALIR: ");
65+
if(user ==="X" || user==="x"){
66+
x=false;
67+
y=false;
68+
break;
69+
} else if (user===this.datosU.usuario){
70+
//NO HAY ACCIONES AQUI,SI VALIDA user, SALTA A BLOQUE WHILE(y) A VALIDAR PASSWORD
71+
break;
72+
}else {alert("INGRESE USUARIO VALIDO O DEBE REGISTRARSE")}
73+
}
74+
while (y) {
75+
let user=prompt("PASSWORD: ");
76+
if (user===this.datosU.pass){
77+
alert("Validacion correcta!! \n SIGA SIGA");
78+
x=false;
79+
y=false;opcion=false;
80+
break;
81+
}else {alert("Clave INCORRECTA")}
82+
}
83+
}
84+
}
85+
86+
/**
87+
* CODIGO
88+
*/
89+
let opcion=true;
90+
const u = new User();
91+
92+
while(opcion){
93+
let opt=parseInt(prompt ("INGRESE OPCION:\n 0. REGISTRO USUARIO\n 1.LOGIN\n 2.SALIR\n\n"));
94+
switch (opt) {
95+
case 0:
96+
u.ingresoDatos();//Pide registro de datos usuario
97+
break;
98+
case 1:
99+
u.login();//Pide Login usando datos ingresados
100+
break;
101+
case 2:
102+
opcion=false;
103+
break;
104+
default:
105+
alert("INGRSE VALOR VALIDO");
106+
break;
107+
}
108+
}
109+
alert("USTED ESTA SALIENDO DEL LOGIN");

Entregas/Entrega2/index.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@
2424
<button type="submit" title="Ingresar" name="Ingresar">Login</button>
2525
</form>
2626
<div class="pie-form">
27-
No tienes usuario?<a href="#">Registrate</a>
27+
No tienes usuario?<a href="./registro.html">Registrate</a>
2828
</div>
2929
</div>
30+
31+
3032
<div class="inferior">
31-
<a href="#">Inicio</a>
33+
<a href="./index.html">Inicio</a>
3234
</div>
3335
</div>
3436
</div>

Entregas/Entrega2/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,15 @@ class User {
5454

5555
login (){
5656
let x=true; let y=true;
57-
console.log("DENTRO DEL LOGIN: "+ this.darUsuario());//LINEA PARA VERIFICACION EN CONSOLA
57+
/* this.usuario=usuario;
58+
this.pass=usuario; */
59+
console.log("DENTRO DEL LOGIN: "+ this.datosU.usuario);//LINEA PARA VERIFICACION EN CONSOLA
5860
if(this.datosU.usuario===null){
5961
alert("DEBE REGISTRAR USUARIO");
6062
this.ingresoDatos();
6163
}
6264
while (x) {
63-
console.log("USUARIO en WHILE(x): "+this.darPass());//LINEA PARA VERIFICACION EN CONSOLA
65+
console.log("USUARIO en WHILE(x): "+this.datosU.pass);//LINEA PARA VERIFICACION EN CONSOLA
6466
let user=prompt("INGRESE USUARIO O X PARA SALIR: ");
6567
if(user ==="X" || user==="x"){
6668
x=false;

Entregas/Entrega2/registro.html

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<link rel="stylesheet" href="./estilos.css" type="text/css">
7+
<script async src="./registro.js"></script>
8+
<title>ENTREGA 02</title>
9+
</head>
10+
11+
<body>
12+
13+
<div id="contenedor">
14+
<div id="central">
15+
<div id="login">
16+
<div class="titulo">
17+
Registro de Usuario
18+
</div>
19+
<form id="loginform">
20+
<input type="text" name="usuario" placeholder="Nombre" required>
21+
<input type="text" name="usuario" placeholder="Apellido" required>
22+
<input type="text" name="usuario" placeholder="Cedula" required>
23+
<input type="password" placeholder="Contrasena" name="password" required>
24+
25+
<button type="submit" title="Ingresar" name="Ingresar">Registrarse</button>
26+
</form>
27+
<div class="pie-form">
28+
Solo usuarios permitidos por el <a href="www.coderhouse.com">administrador</a>
29+
</div>
30+
</div>
31+
32+
33+
<div class="inferior">
34+
<a href="./index.html">Inicio</a>
35+
</div>
36+
</div>
37+
</div>
38+
</body>
39+
</html>

0 commit comments

Comments
 (0)