-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
101 lines (89 loc) · 4.12 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login</title>
<link rel="stylesheet" href="styles.css">
<link href='https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css' rel='stylesheet'>
</head>
<body>
<div class="wrapper">
<!--
<form id="loguinForm" onsubmit="return validateUser()">
<img src="/webGestion/img/ic_ing_round.png" alt="">
<div class="input-box">
<input type="text" id="username" placeholder="Usuario" required>
<i class='bx bxs-user'></i>
</div>
<div class="input-box">
<input type="password" id="password" placeholder="Contraseña" required>
<i class='bx bxs-lock-open-alt'></i>
</div>
<div class="remember-forgot">
<label>
<input type="checkbox"> Recordar Datos
</label>
<a href="/webGestion/indexFinalUser.html">¿Olvidaste la contraseña?</a>
</div>
<button type="submit" class="btn">Login</button>
<button type="button" class="btn btnBack" onclick="document.getElementById('registerForm').style.display='block' , document.getElementById('loguinForm').style.display='none'">Registro</button>
</form>
<form id="registerForm" onsubmit="return registerUser()" style="display:none">
<div class="input-box">
<input type="text" id="newUsername" placeholder="Nuevo Usuario" required>
<i class='bx bxs-user'></i>
</div>
<div class="input-box">
<input type="password" id="newPassword" placeholder="Nueva Contraseña" required>
<i class='bx bxs-lock-open-alt'></i>
</div>
<button type="submit" class="btn">Registrar</button>
<button type="button" class="btn btnBack" onclick="document.getElementById('registerForm').style.display='none' , document.getElementById('loguinForm').style.display='block'">Volver</button>
</form>
-->
<h2 style="margin: 10px; margin-top: 30px;">Selecciona tu tipo de usuario</h2>
<img src="/webGestion/img/ic_ing_round.png" alt="">
<button class="btn btnBack" onclick="redirectTo('usuarioFinal')">Usuario Final</button>
<button class="btn btnBack" onclick="redirectTo('profesional')">Profesional</button>
</div>
<script>
async function registerUser() {
const newUsername = document.getElementById('newUsername').value;
const newPassword = document.getElementById('newPassword').value;
const userData = `${newUsername},${newPassword}\n`;
if ('showSaveFilePicker' in window) {
// Usar la API showSaveFilePicker para guardar el archivo
const opts = {
types: [{
description: 'Text Files',
accept: {'text/plain': ['.txt']}
}]
};
try {
const handle = await window.showSaveFilePicker(opts);
const writable = await handle.createWritable();
await writable.write(userData);
await writable.close();
alert('Usuario registrado con éxito');
} catch (err) {
console.error('Error writing to file', err);
alert('Error al registrar el usuario');
}
} else {
alert('showSaveFilePicker API no es compatible con este navegador.');
}
return false; // Prevent form submission
}
</script>
<script>
function redirectTo(userType) {
if (userType === 'usuarioFinal') {
window.location.href = 'webGestion/FAQ/pags/FAQ.html';
} else if (userType === 'profesional') {
window.location.href = 'webGestion/FAQ/pagsTecnico/FAQ.html';
}
}
</script>
</body>
</html>