Fix veto reg login (1 minuto) x evitare doppie rec

This commit is contained in:
Samuele Locatelli
2024-05-29 10:57:50 +02:00
parent e47744e13f
commit db61bbf471
2 changed files with 26 additions and 2 deletions
+8 -2
View File
@@ -27,6 +27,11 @@ namespace MP_TAB3.Pages
protected int expDays = 1;
protected bool recordLogin = true;
protected bool vetoRecord
{
get => MsgServ.VetoRecordLogin;
set => MsgServ.VetoRecordLogin = value;
}
protected string txtError = "";
protected DateTime vetoScan = DateTime.Now;
@@ -113,9 +118,10 @@ namespace MP_TAB3.Pages
await TDService.OperatoreSetRedis(matrOpr, hash, devGuid);
// se abilitato in config...
if (recordLogin)
if (recordLogin && !vetoRecord)
{
// imposto veto (TTL: 60sec hard-coded)
vetoRecord = true;
// salvo registrazione login utente
string generOpr = $"{rigaOpr.Cognome} {rigaOpr.Nome}";
RegistroDichiarazioniModel ulRec = new RegistroDichiarazioniModel()
+18
View File
@@ -164,6 +164,24 @@ namespace MP.Data.Services
set => redisHashDictSet((RedisKey)$"{redisBaseKey}:{MatrOpr}", value);
}
public bool VetoRecordLogin
{
get
{
bool answ = false;
string rawData = redisDb.StringGet((RedisKey)$"{redisBaseKey}:VetoLoginRec:{MatrOpr}");
if (!string.IsNullOrEmpty(rawData))
{
answ = true;
}
return answ;
}
set
{
redisDb.StringSet((RedisKey)$"{redisBaseKey}:VetoLoginRec:{MatrOpr}", value, TimeSpan.FromSeconds(60));
}
}
#endregion Public Properties
#region Public Methods