* Added Authorization which is not working

This commit is contained in:
2025-02-23 21:19:04 +01:00
parent 6774311433
commit 5bcf406465
29 changed files with 407 additions and 210 deletions

View File

@@ -1,4 +1,9 @@
@page "/login"
@rendermode InteractiveServer
@attribute [AllowAnonymous]
@using Microsoft.AspNetCore.Authorization
@using Microsoft.AspNetCore.Components.Authorization
@using OrdersManagement.Models
@using Syncfusion.Blazor.Inputs
@@ -102,18 +107,18 @@
{
Console.WriteLine($"Próba logowania dla: {LoginModel.Login}");
var user = await UserService.AuthenticateUserAsync(LoginModel.Login, LoginModel.Password);
if (user != null)
{
Console.WriteLine($"Użytkownik {user.Login} znaleziony.");
if (user.IsTemporaryPassword)
{
ShowChangePassword = true;
StateHasChanged(); // Wymagane, aby odświeżyć UI
StateHasChanged();
}
else
{
await ((CustomAuthenticationStateProvider)AuthenticationStateProvider).MarkUserAsAuthenticated(user);
NavigationManager.NavigateTo("/");
NavigationManager.NavigateTo("/ScheduleOrders");
}
}
else