diff --git a/GWMS.UI/Areas/Identity/Pages/Account/Login.cshtml b/GWMS.UI/Areas/Identity/Pages/Account/Login.cshtml
index b55e9a8..e90b7a0 100644
--- a/GWMS.UI/Areas/Identity/Pages/Account/Login.cshtml
+++ b/GWMS.UI/Areas/Identity/Pages/Account/Login.cshtml
@@ -51,40 +51,46 @@
+
+ @if (User.Identity.IsAuthenticated)
+ {
+
USER OK!
+ }
+
@*
-
- Use another service to log in.
-
- @{
- if ((Model.ExternalLogins?.Count ?? 0) == 0)
- {
-
-
- There are no external authentication services configured. See this article
- for details on setting up this ASP.NET application to support logging in via external services.
-
-
- }
- else
- {
-
- }
- }
-
+
+ Use another service to log in.
+
+ @{
+ if ((Model.ExternalLogins?.Count ?? 0) == 0)
+ {
+
+
+ There are no external authentication services configured. See this article
+ for details on setting up this ASP.NET application to support logging in via external services.
+
+
+ }
+ else
+ {
+
+ }
+ }
+
*@
@section Scripts {
-
+
}
\ No newline at end of file
diff --git a/GWMS.UI/Areas/Identity/Pages/Account/Login.cshtml.cs b/GWMS.UI/Areas/Identity/Pages/Account/Login.cshtml.cs
index 32b0e73..69c38d4 100644
--- a/GWMS.UI/Areas/Identity/Pages/Account/Login.cshtml.cs
+++ b/GWMS.UI/Areas/Identity/Pages/Account/Login.cshtml.cs
@@ -101,7 +101,7 @@ namespace GWMS.UI.Areas.Identity.Pages.Account
#region Public Methods
- public async Task OnGetAsync(string returnUrl = null)
+ public async Task OnGetAsync(string returnUrl = null)
{
await CheckSuperAdmin();
if (!string.IsNullOrEmpty(ErrorMessage))
@@ -118,28 +118,55 @@ namespace GWMS.UI.Areas.Identity.Pages.Account
ReturnUrl = returnUrl;
- await checkJumpLogin();
+ var nextPage = await checkJumpLogin();
+ if (!string.IsNullOrEmpty(nextPage))
+ {
+ return LocalRedirect(nextPage);
+ }
+
+ return Page();
}
- private async Task checkJumpLogin()
+ private async Task checkJumpLogin()
{
- // +/- funzionerebbe... da rivedere...
- string returnUrl = Url.Content("~/");
- await Task.Delay(1);
+ string nextPage = "";
+ //string userId = "bffd17ab-d319-4594-939b-6badad7e9450";
+ //string userEmail = "andrei.valeanu@winnlab.it";
+ string userId = "";
+ string userEmail = "";
+ string reqPage = "";
- // controllo l'URL SE contiene user e token... se trovo --> faccio login
- //string userId = "16e4982e-e62a-4ec7-a64b-2ba9fe5876ae";
- //string userEmail = "samuele@teamware.net";
+ // recupero da URL params...
var rawQuery = Request.Query;
- string userId = "bffd17ab-d319-4594-939b-6badad7e9450";
- string userEmail = "andrei.valeanu@winnlab.it";
- var userById = await _userManager.FindByIdAsync(userId);
- var user = await _userManager.FindByEmailAsync(userEmail);
+ if (rawQuery != null)
+ {
+ if (rawQuery.ContainsKey("userId") && rawQuery.ContainsKey("userEmail"))
+ {
+ userId = rawQuery["userId"];
+ userEmail = rawQuery["userEmail"];
+ reqPage = rawQuery["reqPage"];
+ }
+ }
- // se corrispondono --> signini!
- await _signInManager.SignInAsync(user, false);
- _logger.LogInformation("Forced User log in via URL token");
- return LocalRedirect(returnUrl);
+ await Task.Delay(1);
+ if (!string.IsNullOrEmpty(userId) && !string.IsNullOrEmpty(userEmail))
+ {
+ var user = await _userManager.FindByEmailAsync(userEmail);
+ //var userById = await _userManager.FindByIdAsync(userId);
+ if (user != null)
+ {
+ if (user.Id == userId)
+ {
+ // se corrispondono --> signini!
+ await _signInManager.SignInAsync(user, false);
+ _logger.LogInformation("Forced User log in via URL token");
+
+ nextPage = string.IsNullOrEmpty(reqPage) ? "~/../../" : $"~/../../{reqPage}";
+ }
+ }
+ }
+
+ return nextPage;
}
public async Task OnPostAsync(string returnUrl = null)