diff --git a/MP-TAB3/Pages/RegNewDevice.razor.cs b/MP-TAB3/Pages/RegNewDevice.razor.cs index 2556702e..eadff98a 100644 --- a/MP-TAB3/Pages/RegNewDevice.razor.cs +++ b/MP-TAB3/Pages/RegNewDevice.razor.cs @@ -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() diff --git a/MP.Data/Services/MessageService.cs b/MP.Data/Services/MessageService.cs index 8f3c661b..2ebba5c2 100644 --- a/MP.Data/Services/MessageService.cs +++ b/MP.Data/Services/MessageService.cs @@ -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