login.html
9.55 KB
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>SIGEM-GIS | Acceso Institucional AdminLTE 3</title>
<!-- Google Font: Inter -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&display=swap">
<!-- Font Awesome -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
<!-- AdminLTE 3.2 Modernized -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/admin-lte@3.2/dist/css/adminlte.min.css">
<style>
body.login-page {
background: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 50, 100, 0.8)),
url('https://images.unsplash.com/photo-1524661135-423995f22d0b?auto=format&fit=crop&q=80&w=1920') no-repeat center center fixed;
background-size: cover;
font-family: 'Inter', sans-serif;
height: 100vh;
}
.login-box { width: 480px !important; }
.card-primary.card-outline { border-top: 4px solid #17a2b8; background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(10px); }
.login-logo a { color: #fff; font-weight: 700; text-shadow: 2px 2px 4px rgba(0,0,0,0.5); }
#entidad {
border: 1px solid #dee2e6;
border-radius: 8px;
padding: 8px;
width: 100%;
height: 140px !important;
background: #f8f9fa;
}
#entidad option { padding: 10px; border-bottom: 1px solid #eee; }
#entidad option:checked { background-color: #17a2b8 !important; color: white; }
.input-group-text { background-color: #f4f6f9; border-left: 0; }
.form-control:focus { border-color: #17a2b8; box-shadow: none; }
.btn-modern {
background: #17a2b8;
border: none;
border-radius: 8px;
padding: 12px;
font-weight: 600;
letter-spacing: 1px;
transition: all 0.3s;
}
.btn-modern:hover { background: #138496; transform: translateY(-2px); }
.institutional-banner {
background: #343a40;
color: #ffc107;
padding: 5px;
border-radius: 4px;
font-size: 0.75rem;
font-weight: bold;
display: inline-block;
margin-bottom: 15px;
}
</style>
</head>
<body class="hold-transition login-page">
<div class="login-box">
<div class="login-logo mb-4">
<a href="#">SIGEM<span class="text-info">GIS</span> 2026</a>
</div>
<div class="card card-primary card-outline shadow-lg border-0">
<div class="card-body login-card-body rounded">
<div class="text-center">
<span class="institutional-banner uppercase">SISTEMA DE GESTIÓN CATASTRAL</span>
<h4 class="mb-3 font-weight-bold text-dark">Portal de Acceso</h4>
<p class="text-muted text-sm mb-4">Seleccione su institución y valide sus credenciales</p>
</div>
<form id="loginForm">
<!-- Filtro de Entidad -->
<div class="form-group mb-3">
<label class="text-xs text-info font-weight-bold">BÚSQUEDA DE MUNICIPIO</label>
<div class="input-group">
<input type="text" id="municipioSearch" class="form-control" placeholder="Nombre o código entidad..." autocomplete="off">
<div class="input-group-append">
<div class="input-group-text"><i class="fas fa-search text-info"></i></div>
</div>
</div>
</div>
<div class="form-group mb-4">
<select id="entidad" required size="4" class="form-control custom-scroll">
<option value="505" selected>505 - MUNICIPALIDAD DE REPATRIACIÓN</option>
<option value="800">800 - ENTIDAD DE PRUEBAS SIGEM</option>
<option value="900">900 - LABORATORIO DE DESARROLLO</option>
</select>
</div>
<div class="row">
<div class="col-6">
<div class="form-group mb-3">
<label class="text-xs text-secondary font-weight-bold">USUARIO</label>
<div class="input-group">
<input type="text" id="username" class="form-control" placeholder="operador" required>
<div class="input-group-append">
<div class="input-group-text"><i class="fas fa-user-shield"></i></div>
</div>
</div>
</div>
</div>
<div class="col-6">
<div class="form-group mb-3">
<label class="text-xs text-secondary font-weight-bold">CONTRASEÑA</label>
<div class="input-group">
<input type="password" id="password" class="form-control" placeholder="••••••••" required>
<div class="input-group-append">
<div class="input-group-text"><i class="fas fa-key"></i></div>
</div>
</div>
</div>
</div>
</div>
<div class="mt-4">
<button type="submit" id="btn-login" class="btn btn-info btn-block btn-modern shadow">
<span id="btn-text">ACCEDER AL ECOSISTEMA</span>
<div class="spinner-border spinner-border-sm text-light d-none" id="spinner" role="status"></div>
</button>
</div>
<div id="error-msg" class="alert alert-danger mt-3 text-sm d-none animate__animated animate__shakeX"></div>
</form>
</div>
<div class="card-footer bg-light text-center border-0 py-3">
<p class="mb-0 text-xs text-muted">Infraestructura Geográfica Digital © 2026 <b>YVAGA</b></p>
</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/admin-lte@3.2/dist/js/adminlte.min.js"></script>
<script>
// --- LÓGICA INSTITUCIONAL RECUPERADA (03 DE ABRIL) ---
const searchInput = $('#municipioSearch');
const selectEntidad = $('#entidad');
const originalOptions = selectEntidad.find('option').clone();
searchInput.on('input', function() {
const text = $(this).val().toLowerCase();
selectEntidad.empty();
originalOptions.each(function() {
const opt = $(this);
if (opt.text().toLowerCase().includes(text) || opt.val().includes(text)) {
selectEntidad.append(opt.clone());
}
});
if (selectEntidad.find('option').length > 0) {
selectEntidad.find('option').first().prop('selected', true);
bksp20();
}
});
selectEntidad.on('change', bksp20);
// TÉCNICA BKSP 20: El corazón del borrado seguro de ayer
function bksp20() {
$('#username').val('');
$('#password').val('');
for(let i=0; i<20; i++) {
const e = jQuery.Event('keydown', { keyCode: 8, which: 8 });
$('#username').trigger(e);
$('#password').trigger(e);
}
$('#error-msg').addClass('d-none');
}
// --- PROCESO DE AUTENTICACIÓN DOCKER-INTEGRATED ---
$('#loginForm').on('submit', function(e) {
e.preventDefault();
const username = $('#username').val();
const password = $('#password').val();
const entidad = $('#entidad').val();
const errorMsg = $('#error-msg');
const spinner = $('#spinner');
const btnLogin = $('#btn-login');
const btnText = $('#btn-text');
errorMsg.addClass('d-none').text("");
spinner.removeClass('d-none');
btnText.text("AUTENTICANDO...");
btnLogin.prop('disabled', true);
fetch('/gis-geoserver/api/auth/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ username, password, entidad })
})
.then(response => {
if (!response.ok) return response.json().then(e => { throw new Error(e.message || "Error de acceso"); });
return response.json();
})
.then(data => {
// Persistencia de Sesión
localStorage.setItem('jwt', data.token);
localStorage.setItem('entidad', entidad);
localStorage.setItem('map_lat', data.lat);
localStorage.setItem('map_lng', data.lng);
localStorage.setItem('map_zoom', data.zoom);
// Redirección al Visor Dual Institucional
window.location.href = "/gis-geoserver/mapas_institucional.html";
})
.catch(error => {
errorMsg.text(error.message).removeClass('d-none');
spinner.addClass('d-none');
btnText.text("ACCEDER AL ECOSISTEMA");
btnLogin.prop('disabled', false);
});
});
</script>
</body>
</html>