#6656 addUserSignIn #18
|
@ -1,9 +1,7 @@
|
||||||
let pin = "";
|
let pin = "";
|
||||||
let pass = "";
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
FastClick.attach(document.body);
|
FastClick.attach(document.body);
|
||||||
if(!localStorage.getItem('user')) localStorage.setItem('user', user);
|
|
||||||
setEvents();
|
setEvents();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -14,13 +12,15 @@ function setEvents() {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: 'Iniciar sesión',
|
title: 'Iniciar sesión',
|
||||||
html:
|
html:
|
||||||
'<input id="pass" class="swal2-input" type="password" placeholder="Contraseña">',
|
`<input id="user" class="swal2-input" type="text" placeholder="Usuario" value="${localStorage.getItem('user') ?? ""}">
|
||||||
|
<input id="pass" class="swal2-input" type="password" placeholder="Contraseña">`,
|
||||||
confirmButtonText: 'Login',
|
confirmButtonText: 'Login',
|
||||||
showCloseButton: true,
|
showCloseButton: true,
|
||||||
showCancelButton: false,
|
showCancelButton: false,
|
||||||
}).then(async (result) => {
|
}).then(async (result) => {
|
||||||
if(result.isConfirmed) {
|
if(result.isConfirmed) {
|
||||||
pass = $('#pass').val();
|
const user = $('#user').val();
|
||||||
|
const pass = $('#pass').val();
|
||||||
signIn(user,pass);
|
signIn(user,pass);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -64,6 +64,7 @@ function signIn(user, password) {
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
localStorage.setItem("token", data.token);
|
localStorage.setItem("token", data.token);
|
||||||
localStorage.setItem("ttl", data.ttl);
|
localStorage.setItem("ttl", data.ttl);
|
||||||
|
localStorage.setItem("user", user);
|
||||||
localStorage.setItem("password", password);
|
localStorage.setItem("password", password);
|
||||||
localStorage.setItem("created", Date.now());
|
localStorage.setItem("created", Date.now());
|
||||||
getTokenConfig();
|
getTokenConfig();
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
const user = "timeControl";
|
|
||||||
const renewPeriod = localStorage.getItem('renewPeriod');
|
const renewPeriod = localStorage.getItem('renewPeriod');
|
||||||
let intervalId, isCheckingToken;
|
let intervalId, isCheckingToken;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue