#6656 addUserSignIn #18

Merged
jorgep merged 2 commits from 6656-addUserSingIn into test 2024-01-10 13:42:58 +00:00
2 changed files with 5 additions and 5 deletions
Showing only changes of commit 8d122e44bf - Show all commits

View File

@ -1,9 +1,7 @@
let pin = "";
let pass = "";
$(document).ready(function () {
FastClick.attach(document.body);
if(!localStorage.getItem('user')) localStorage.setItem('user', user);
setEvents();
});
@ -14,13 +12,15 @@ function setEvents() {
Swal.fire({
title: 'Iniciar sesión',
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') ?? ""}">

Si no pongo esto , muestra null

Si no pongo esto , muestra null
<input id="pass" class="swal2-input" type="password" placeholder="Contraseña">`,
confirmButtonText: 'Login',
showCloseButton: true,
showCancelButton: false,
}).then(async (result) => {
if(result.isConfirmed) {
pass = $('#pass').val();
const user = $('#user').val();
const pass = $('#pass').val();
signIn(user,pass);
}
});
@ -64,6 +64,7 @@ function signIn(user, password) {
success: function (data) {
localStorage.setItem("token", data.token);
localStorage.setItem("ttl", data.ttl);
localStorage.setItem("user", user);
localStorage.setItem("password", password);
localStorage.setItem("created", Date.now());
getTokenConfig();

View File

@ -1,4 +1,3 @@
const user = "timeControl";
const renewPeriod = localStorage.getItem('renewPeriod');
let intervalId, isCheckingToken;