Fix login che sparisce da timeout cookie
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<Version>6.16.2312.1215</Version>
|
||||
<Version>6.16.2312.1216</Version>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP_TAB_SERV</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -38,14 +38,7 @@
|
||||
<a class="dismiss">🗙</a>
|
||||
</div>
|
||||
|
||||
@*<script src="_content/ZXingBlazor/lib/barcodereader/zxing.js"></script>
|
||||
<script src="_content/ZXingBlazor/lib/barcodereader/barcode.js"></script>*@
|
||||
@*<script src="_content/ZXingBlazor/lib/barcodereader/zxing.js"></script>*@
|
||||
@*<script src="_content/ZXingBlazor/lib/zxing/zxing.min.js"></script>
|
||||
<script src="MP/TAB3/_content/ZXingBlazor/lib/zxing/zxing.min.js"></script>*@
|
||||
@*<script src="_content/ZXingBlazor/lib/barcodereader/barcode.js"></script>*@
|
||||
<script src="~/lib//BarcodeReade.razor.js"></script>
|
||||
|
||||
<script src="lib/WindowSize.js"></script>
|
||||
<script src="lib/bootstrap/js/bootstrap.bundle.js"></script>
|
||||
<script src="_framework/blazor.server.js"></script>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MAPOSPEC </i>
|
||||
<h4>Versione: 6.16.2312.1215</h4>
|
||||
<h4>Versione: 6.16.2312.1216</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2312.1215
|
||||
6.16.2312.1216
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2312.1215</version>
|
||||
<version>6.16.2312.1216</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-TAB-SERV/stable/LAST/MP-TAB-SERV.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-TAB-SERV/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
@@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Components.Routing;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.Data.DatabaseModels;
|
||||
using MP.Data.Services;
|
||||
using MP_TAB_SERV.Components;
|
||||
using NLog;
|
||||
|
||||
namespace MP_TAB_SERV.Shared
|
||||
@@ -65,14 +66,24 @@ namespace MP_TAB_SERV.Shared
|
||||
|
||||
protected string bodyTipe
|
||||
{
|
||||
get => NavMan.Uri.Contains("reg-new-device") ? "mainBodyNoSide" : "mainBody";
|
||||
get => pageOk ? "mainBodyNoSide" : "mainBody";
|
||||
}
|
||||
|
||||
protected bool pageOk
|
||||
{
|
||||
get
|
||||
{
|
||||
string currPage = NavMan.Uri;
|
||||
return currPage.Contains("logout") || currPage.Contains("reg-new-device");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected async Task handleBodyClick()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
if (!NavMan.Uri.Contains("reg-new-device"))
|
||||
MsgServ.dtLastAction = DateTime.Now;
|
||||
if (!pageOk)
|
||||
{
|
||||
await checkDtDiff2Logout();
|
||||
}
|
||||
@@ -87,29 +98,43 @@ namespace MP_TAB_SERV.Shared
|
||||
|
||||
protected async Task checkDtDiff2Logout()
|
||||
{
|
||||
var diffOfTime = DateTime.Now - MsgServ.dtLastAction;
|
||||
TimeSpan tsDeltaAct = DateTime.Now.Subtract(MsgServ.dtLastAction);
|
||||
TimeSpan tsDeltaSave = DateTime.Now.Subtract(MsgServ.dtLastSave);
|
||||
switch (typeScadLogin)
|
||||
{
|
||||
case 0:
|
||||
if (diffOfTime.Minutes >= dtScadLogin)
|
||||
if (tsDeltaAct.Minutes >= dtScadLogin)
|
||||
{
|
||||
NavMan.NavigateTo("logout");
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (diffOfTime.Minutes >= dtScadLogin)
|
||||
if (tsDeltaAct.Minutes >= dtScadLogin)
|
||||
{
|
||||
var userTkn = await TDataService.OperatoreGetRedis(MatrOpr);
|
||||
if (!string.IsNullOrEmpty(userTkn))
|
||||
{
|
||||
await MsgServ.DoLogIn(userTkn);
|
||||
MsgServ.dtLastAction = DateTime.Now;
|
||||
MsgServ.dtLastSave = DateTime.Now;
|
||||
}
|
||||
else
|
||||
{
|
||||
NavMan.NavigateTo("logout");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// se fosse oltre mezzo periodo da ultimo save --> salvo!
|
||||
if (tsDeltaSave.TotalMinutes > dtScadLogin * 0.8)
|
||||
{
|
||||
var userTkn = await TDataService.OperatoreGetRedis(MatrOpr);
|
||||
if (!string.IsNullOrEmpty(userTkn))
|
||||
{
|
||||
await MsgServ.DoLogIn(userTkn);
|
||||
MsgServ.dtLastSave = DateTime.Now;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,6 +119,7 @@ namespace MP.Data.Services
|
||||
}
|
||||
|
||||
public DateTime dtLastAction { get; set; } = DateTime.Now;
|
||||
public DateTime dtLastSave { get; set; } = DateTime.Now;
|
||||
|
||||
public int MatrOpr
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user