Compare commits

...

9 Commits

Author SHA1 Message Date
Samuele Locatelli 2655dfcb41 Merge tag 'FixLayoutReload01' into develop
Fix layout relaod blazor js
2024-02-19 19:53:17 +01:00
Samuele Locatelli 0690754a58 Merge branch 'release/FixLayoutReload01' 2024-02-19 19:53:04 +01:00
Samuele Locatelli 32ab150dda Fox layout home reload 2024-02-19 19:52:41 +01:00
Samuele Locatelli 4e3d8f79ef Merge tag 'FixMainCiCd01' into develop
Fix ci/cd x main con restore soluzione esplicito
2024-02-19 15:24:27 +01:00
Samuele Locatelli 4976afeb8e Merge branch 'release/FixMainCiCd01' 2024-02-19 15:24:16 +01:00
Samuele Locatelli 5e954f6cf6 fix CI/CD di MAIN 2024-02-19 15:23:53 +01:00
Samuele Locatelli f7b8f394a5 Merge tag 'UpdateLayoutReload01' into develop
Update base layout x reload page
2024-02-19 14:33:23 +01:00
Samuele Locatelli 4c1577fa8e Merge branch 'release/UpdateLayoutReload01' 2024-02-19 14:32:55 +01:00
Samuele Locatelli 3c88852245 Update base page x reload 2024-02-19 14:32:07 +01:00
8 changed files with 134 additions and 116 deletions
+2 -2
View File
@@ -80,8 +80,8 @@ installer:
- master
needs: ["build"]
before_script:
# - *nuget-fix
# - dotnet restore
- *nuget-fix
- dotnet restore GWMS.sln
script:
# - dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release GWMS.UI/GWMS.UI.csproj -o:publish
# pubblico solo installer Linux x64: https://docs.microsoft.com/en-us/dotnet/core/deploying/
@@ -15,21 +15,9 @@ namespace GWMS.UI.Areas.Identity.Pages.Account
[AllowAnonymous]
public class LoginModel : PageModel
{
#region Private Fields
private IConfiguration _configuration;
private readonly ILogger<LoginModel> _logger;
private readonly SignInManager<IdentityUser> _signInManager;
private readonly UserManager<IdentityUser> _userManager;
#endregion Private Fields
#region Public Constructors
public LoginModel(SignInManager<IdentityUser> signInManager,
ILogger<LoginModel> logger,
UserManager<IdentityUser> userManager,
IConfiguration configuration)
public LoginModel(SignInManager<IdentityUser> signInManager, ILogger<LoginModel> logger, UserManager<IdentityUser> userManager, IConfiguration configuration)
{
_userManager = userManager;
_signInManager = signInManager;
@@ -53,6 +41,103 @@ namespace GWMS.UI.Areas.Identity.Pages.Account
#endregion Public Properties
#region Public Methods
public async Task<IActionResult> OnGetAsync(string returnUrl = null)
{
await CheckSuperAdmin();
if (!string.IsNullOrEmpty(ErrorMessage))
{
ModelState.AddModelError(string.Empty, ErrorMessage);
}
returnUrl ??= Url.Content("~/");
// Clear the existing external cookie to ensure a clean login process
await HttpContext.SignOutAsync(IdentityConstants.ExternalScheme);
ExternalLogins = (await _signInManager.GetExternalAuthenticationSchemesAsync()).ToList();
ReturnUrl = returnUrl;
var nextPage = await checkJumpLogin();
if (!string.IsNullOrEmpty(nextPage))
{
return LocalRedirect(nextPage);
}
return Page();
}
public async Task<IActionResult> OnPostAsync(string returnUrl = null)
{
returnUrl ??= Url.Content("~/");
ExternalLogins = (await _signInManager.GetExternalAuthenticationSchemesAsync()).ToList();
if (ModelState.IsValid)
{
// This doesn't count login failures towards account lockout To enable password
// failures to trigger account lockout, set lockoutOnFailure: true
var result = await _signInManager.PasswordSignInAsync(Input.Email, Input.Password, Input.RememberMe, lockoutOnFailure: false);
if (result.Succeeded)
{
_logger.LogInformation("User logged in.");
return LocalRedirect(returnUrl);
}
if (result.RequiresTwoFactor)
{
return RedirectToPage("./LoginWith2fa", new { ReturnUrl = returnUrl, RememberMe = Input.RememberMe });
}
if (result.IsLockedOut)
{
_logger.LogWarning("User account locked out.");
return RedirectToPage("./Lockout");
}
else
{
ModelState.AddModelError(string.Empty, "Invalid login attempt.");
return Page();
}
}
// If we got this far, something failed, redisplay form
return Page();
}
#endregion Public Methods
#region Public Classes
public class InputModel
{
#region Public Properties
[Required]
[EmailAddress]
public string Email { get; set; }
[Required]
[DataType(DataType.Password)]
public string Password { get; set; }
[Display(Name = "Remember me?")]
public bool RememberMe { get; set; }
#endregion Public Properties
}
#endregion Public Classes
#region Private Fields
private readonly ILogger<LoginModel> _logger;
private readonly SignInManager<IdentityUser> _signInManager;
private readonly UserManager<IdentityUser> _userManager;
private IConfiguration _configuration;
#endregion Private Fields
#region Private Methods
private async Task<string> checkJumpLogin()
@@ -148,93 +233,5 @@ namespace GWMS.UI.Areas.Identity.Pages.Account
}
#endregion Private Methods
#region Public Methods
public async Task<IActionResult> OnGetAsync(string returnUrl = null)
{
await CheckSuperAdmin();
if (!string.IsNullOrEmpty(ErrorMessage))
{
ModelState.AddModelError(string.Empty, ErrorMessage);
}
returnUrl ??= Url.Content("~/");
// Clear the existing external cookie to ensure a clean login process
await HttpContext.SignOutAsync(IdentityConstants.ExternalScheme);
ExternalLogins = (await _signInManager.GetExternalAuthenticationSchemesAsync()).ToList();
ReturnUrl = returnUrl;
var nextPage = await checkJumpLogin();
if (!string.IsNullOrEmpty(nextPage))
{
return LocalRedirect(nextPage);
}
return Page();
}
public async Task<IActionResult> OnPostAsync(string returnUrl = null)
{
returnUrl ??= Url.Content("~/");
ExternalLogins = (await _signInManager.GetExternalAuthenticationSchemesAsync()).ToList();
if (ModelState.IsValid)
{
// This doesn't count login failures towards account lockout
// To enable password failures to trigger account lockout, set lockoutOnFailure: true
var result = await _signInManager.PasswordSignInAsync(Input.Email, Input.Password, Input.RememberMe, lockoutOnFailure: false);
if (result.Succeeded)
{
_logger.LogInformation("User logged in.");
return LocalRedirect(returnUrl);
}
if (result.RequiresTwoFactor)
{
return RedirectToPage("./LoginWith2fa", new { ReturnUrl = returnUrl, RememberMe = Input.RememberMe });
}
if (result.IsLockedOut)
{
_logger.LogWarning("User account locked out.");
return RedirectToPage("./Lockout");
}
else
{
ModelState.AddModelError(string.Empty, "Invalid login attempt.");
return Page();
}
}
// If we got this far, something failed, redisplay form
return Page();
}
#endregion Public Methods
#region Public Classes
public class InputModel
{
#region Public Properties
[Required]
[EmailAddress]
public string Email { get; set; }
[Required]
[DataType(DataType.Password)]
public string Password { get; set; }
[Display(Name = "Remember me?")]
public bool RememberMe { get; set; }
#endregion Public Properties
}
#endregion Public Classes
}
}
+1 -1
View File
@@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Version>1.0.2309.0513</Version>
<Version>1.0.2402.1919</Version>
<UserSecretsId>95c9f021-52d1-4390-a670-5810b7b777b0</UserSecretsId>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild>
+1 -1
View File
@@ -77,8 +77,8 @@
/* ((e) => { BarCode = e; ShowScanBarcode = !ShowScanBarcode; }) */
<BarcodeReader ScanResult="(e) => ScanDoneHandler(e)"
ShowScanBarcode="ShowScanBarcode"
Close="() => ResetScanner()"
ShowScanBarcode="ShowScanBarcode"
ScanBtnTitle="Scan"
ResetBtnTitle="Reset"
CloseBtnTitle="Close"
+29 -8
View File
@@ -40,13 +40,6 @@
<a class="dismiss">🗙</a>
</div>
@* Riconnessione server app: https://www.syncfusion.com/faq/how-do-i-reconnect-blazor-server-side-automatically *@
@* <script>
Blazor.defaultReconnectionHandler._reconnectCallback = function (d) {
document.location.reload();
}
</script>*@
<!-- inside of body section and after the div/app tag -->
<script src="jquery/jquery.min.js"></script>
<script src="lib/Chart.js/chart.min.js"></script>
@@ -61,7 +54,35 @@
<script src="_content/ZXingBlazor/lib/barcodereader/barcode.js"></script>
<script src="lib/font-awesome/js/all.min.js"></script>
<script src="_framework/blazor.server.js"></script>
<script src="_framework/blazor.server.js" autostart="false"></script>
@*Gestione autoriconnessione: https://github.com/dotnet/aspnetcore/issues/38305 (vedere anche https://docs.microsoft.com/it-it/aspnet/core/blazor/fundamentals/signalr?view=aspnetcore-6.0#modify-the-reconnection-handler-blazor-server)*@
<script>
Blazor.start({
reconnectionOptions: {
maxRetries: 600,
retryIntervalMilliseconds: 1000
},
reconnectionHandler: {
onConnectionDown: (options, error) => console.error(error),
onConnectionUp: () => console.log("Client reconnected!")
}
}).then(() => {
Object.defineProperty(Blazor.defaultReconnectionHandler, '_reconnectionDisplay', {
get() {
return this.__reconnectionDisplay;
},
set(value) {
this.__reconnectionDisplay = {
show: () => value.show(),
update: (d) => value.update(d),
rejected: (d) => document.location.reload()
}
}
});
});
</script>
<script type="text/javascript" src="lib/qrcode.js"></script>
<script type="text/javascript" src="lib/dispQr.js"></script>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>GWMS - Gas Warehouse Management System</i>
<h4>Versione: 1.0.2309.0513</h4>
<h4>Versione: 1.0.2402.1919</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
1.0.2309.0513
1.0.2402.1919
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.0.2309.0513</version>
<version>1.0.2402.1919</version>
<url>http://nexus.steamware.net/repository/SWS/GWMS/stable/0/GWMS.UI.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/GWMS/stable/0/ChangeLog.html</changelog>
<mandatory>false</mandatory>