forse fix logout per ogni interazione
This commit is contained in:
@@ -26,13 +26,15 @@ namespace MP.Data.Services
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public MessageService(IConfiguration configuration, ILocalStorageService genLocalStorage, ISessionStorageService sessStore)
|
||||
public MessageService(IConfiguration configuration, ILocalStorageService genLocalStorage, ISessionStorageService sessStore, TabDataService tdService, SharedMemService smServ)
|
||||
{
|
||||
_configuration = configuration;
|
||||
|
||||
// gestione sessioni in browser
|
||||
localStorage = genLocalStorage;
|
||||
sessionStore = sessStore;
|
||||
TDService = tdService;
|
||||
SMService = smServ;
|
||||
|
||||
// setup compoenti REDIS
|
||||
redisConn = ConnectionMultiplexer.Connect(_configuration.GetConnectionString("Redis"));
|
||||
@@ -436,6 +438,48 @@ namespace MP.Data.Services
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected int expDays { get; set; } = 0;
|
||||
|
||||
public async Task<bool> DoLogIn(string decodValue)
|
||||
{
|
||||
bool answ = false;
|
||||
expDays = SMService.GetConfInt("cookieDayExpire");
|
||||
var expDT = DateTime.Now.AddDays(expDays);
|
||||
// decifro i valori..
|
||||
var decrVal = DecryptData(decodValue);
|
||||
var opData = JsonConvert.DeserializeObject<userTknDTO>(decrVal);
|
||||
if (opData != null)
|
||||
{
|
||||
var rigaOpr = await TDService.OperatoreSearch(opData.currOpr.MatrOpr, opData.currOpr.authKey);
|
||||
if (rigaOpr != null)
|
||||
{
|
||||
userTknDTO newUserTkn = new userTknDTO()
|
||||
{
|
||||
currOpr = rigaOpr,
|
||||
expTime = expDT
|
||||
};
|
||||
|
||||
var jsonTkn = JsonConvert.SerializeObject(newUserTkn);
|
||||
string hash = TDService.EncryptData(jsonTkn);
|
||||
RigaOper = rigaOpr;
|
||||
await SetLastMatrOprAsync(rigaOpr.MatrOpr);
|
||||
await SetCurrOperDtoAsync(hash);
|
||||
await TDService.OperatoreSetRedis(rigaOpr.MatrOpr, hash);
|
||||
answ = true;
|
||||
//if (LastOpenedPage != "" && CurrMacc != "")
|
||||
//{
|
||||
// NavMan.NavigateTo(LastOpenedPage);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// NavMan.NavigateTo("status-map");
|
||||
//}
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Salva matrOpr nel localstorage
|
||||
/// </summary>
|
||||
@@ -534,6 +578,8 @@ namespace MP.Data.Services
|
||||
#region Protected Properties
|
||||
|
||||
protected ILocalStorageService localStorage { get; set; } = null!;
|
||||
protected TabDataService TDService { get; set; } = null!;
|
||||
protected SharedMemService SMService { get; set; } = null!;
|
||||
|
||||
protected ISessionStorageService sessionStore { get; set; } = null!;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user