diff --git a/MP.INVE/Data/LoginService.cs b/MP.INVE/Data/LoginService.cs index b76a8741..dd08f946 100644 --- a/MP.INVE/Data/LoginService.cs +++ b/MP.INVE/Data/LoginService.cs @@ -67,10 +67,17 @@ namespace MP.INVE.Data int answ = 0; if (HttpContextAccessor.HttpContext != null) { +#if false var token = HttpContextAccessor.HttpContext.Request.Cookies["userId_token"]; if (token != null) { int.TryParse(token, out answ); + } +#endif + var currUser = UserDTO(matrOpr, authKey); + if (currUser != null) + { + answ = currUser.MatrOpr; } } return answ; @@ -167,6 +174,7 @@ namespace MP.INVE.Data bool fatto = false; Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); + string source = "REDIS"; // cerco in redis... string rawData = JsonConvert.SerializeObject(userData); diff --git a/MP.INVE/Pages/OperatoreLogin.razor.cs b/MP.INVE/Pages/OperatoreLogin.razor.cs index 40220f62..1aaee477 100644 --- a/MP.INVE/Pages/OperatoreLogin.razor.cs +++ b/MP.INVE/Pages/OperatoreLogin.razor.cs @@ -66,7 +66,7 @@ namespace MP.INVE.Pages LServ.UserDTOSave(oprDto); } - NavManager.NavigateTo("/Starter", true); + NavManager.NavigateTo("Starter", true); } else { diff --git a/MP.INVE/Pages/Starter.razor b/MP.INVE/Pages/Starter.razor index 47b44abf..1f41fc74 100644 --- a/MP.INVE/Pages/Starter.razor +++ b/MP.INVE/Pages/Starter.razor @@ -9,34 +9,4 @@ @**@ -@code { - [Inject] - private IConfiguration Configuration { get; set; } = null!; - protected override async Task OnAfterRenderAsync(bool firstRender) - { - if (firstRender) - { - await JSRuntime.InvokeVoidAsync("clearContent", $"qrCodeImg_{101}"); - await JSRuntime.InvokeVoidAsync("displayQr", $"qrCodeImg_{101}", rawCode); - } - } - - protected string BaseUrlTab - { - get => $"{Configuration["ServerConf:BaseUrl"]}"; - } - - - protected string rawCode - { - get - { - string answ = ""; - answ = $"{BaseUrlTab}MatrOpr={101}&UserAuthKey={12345}"; - return answ; - } - } - - -} diff --git a/MP.INVE/Pages/Starter.razor.cs b/MP.INVE/Pages/Starter.razor.cs new file mode 100644 index 00000000..1227da09 --- /dev/null +++ b/MP.INVE/Pages/Starter.razor.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Components; +using System.Net.Http; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Components.Authorization; +using Microsoft.AspNetCore.Components.Forms; +using Microsoft.AspNetCore.Components.Routing; +using Microsoft.AspNetCore.Components.Web; +using Microsoft.AspNetCore.Components.Web.Virtualization; +using Microsoft.JSInterop; +using MP.INVE; +using MP.INVE.Shared; +using MP.INVE.Components; + +namespace MP.INVE.Pages +{ + public partial class Starter + { + [Inject] + private IConfiguration Configuration { get; set; } = null !; + protected override async Task OnAfterRenderAsync(bool firstRender) + { + if (firstRender) + { + await JSRuntime.InvokeVoidAsync("clearContent", $"qrCodeImg_{101}"); + await JSRuntime.InvokeVoidAsync("displayQr", $"qrCodeImg_{101}", rawCode); + } + } + + protected string BaseUrlTab { get => $"{Configuration["ServerConf:BaseUrl"]}"; } + + protected string rawCode + { + get + { + string answ = ""; + answ = $"{BaseUrlTab}MatrOpr={101}&UserAuthKey={12345}"; + return answ; + } + } + } +} \ No newline at end of file