* Turned off Login as it is not working
This commit is contained in:
@@ -7,7 +7,6 @@ namespace FaKrosnoApi.Controllers
|
|||||||
{
|
{
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("api/[controller]")]
|
[Route("api/[controller]")]
|
||||||
[Authorize]
|
|
||||||
public class ErrorLogController(IErrorLogService service) : Controller
|
public class ErrorLogController(IErrorLogService service) : Controller
|
||||||
{
|
{
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ namespace FaKrosnoApi.Controllers
|
|||||||
{
|
{
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("api/[controller]")]
|
[Route("api/[controller]")]
|
||||||
[Authorize]
|
|
||||||
public class ScheduleOrdersController(IScheduleOrderService service) : Controller
|
public class ScheduleOrdersController(IScheduleOrderService service) : Controller
|
||||||
{
|
{
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ using OrdersManagementDataModel.Services;
|
|||||||
|
|
||||||
namespace FaKrosnoApi.Controllers;
|
namespace FaKrosnoApi.Controllers;
|
||||||
|
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/[controller]")]
|
||||||
public class UserRolesController(IUserRoleService service) : Controller
|
public class UserRolesController(IUserRoleService service) : Controller
|
||||||
{
|
{
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
|
|||||||
@@ -32,21 +32,21 @@ builder.Services.Configure<JobSettingsModel>(builder.Configuration.GetSection("J
|
|||||||
|
|
||||||
builder.WebHost.UseUrls("http://*:5001");
|
builder.WebHost.UseUrls("http://*:5001");
|
||||||
|
|
||||||
builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
|
// builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
|
||||||
.AddJwtBearer(options =>
|
// .AddJwtBearer(options =>
|
||||||
{
|
// {
|
||||||
options.TokenValidationParameters = new TokenValidationParameters
|
// options.TokenValidationParameters = new TokenValidationParameters
|
||||||
{
|
// {
|
||||||
ValidateIssuer = true,
|
// ValidateIssuer = true,
|
||||||
ValidateAudience = true,
|
// ValidateAudience = true,
|
||||||
ValidateLifetime = true,
|
// ValidateLifetime = true,
|
||||||
ValidateIssuerSigningKey = true,
|
// ValidateIssuerSigningKey = true,
|
||||||
ValidIssuer = builder.Configuration["Jwt:Issuer"],
|
// ValidIssuer = builder.Configuration["Jwt:Issuer"],
|
||||||
ValidAudience = builder.Configuration["Jwt:Audience"],
|
// ValidAudience = builder.Configuration["Jwt:Audience"],
|
||||||
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(builder.Configuration["Jwt:Key"] ?? string.Empty)),
|
// IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(builder.Configuration["Jwt:Key"] ?? string.Empty)),
|
||||||
NameClaimType = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier"
|
// NameClaimType = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier"
|
||||||
};
|
// };
|
||||||
});
|
// });
|
||||||
|
|
||||||
builder.Services.AddControllers();
|
builder.Services.AddControllers();
|
||||||
builder.Services.AddEndpointsApiExplorer();
|
builder.Services.AddEndpointsApiExplorer();
|
||||||
|
|||||||
@@ -20,21 +20,6 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
<Routes @rendermode="@InteractiveServer" />
|
<Routes @rendermode="@InteractiveServer" />
|
||||||
<CascadingAuthenticationState>
|
|
||||||
<Router AppAssembly="@typeof(App).Assembly">
|
|
||||||
<Found Context="routeData">
|
|
||||||
<AuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)">
|
|
||||||
<NotAuthorized>
|
|
||||||
<h3>Brak autoryzacji</h3>
|
|
||||||
<p><a href="/login">Zaloguj się</a></p>
|
|
||||||
</NotAuthorized>
|
|
||||||
</AuthorizeRouteView>
|
|
||||||
</Found>
|
|
||||||
<NotFound>
|
|
||||||
<p>Strona nie znaleziona.</p>
|
|
||||||
</NotFound>
|
|
||||||
</Router>
|
|
||||||
</CascadingAuthenticationState>
|
|
||||||
<script src="_framework/blazor.web.js"></script>
|
<script src="_framework/blazor.web.js"></script>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" crossorigin="anonymous"></script>
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" crossorigin="anonymous"></script>
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/4.0.1/chart.umd.js" integrity="sha512-gQhCDsnnnUfaRzD8k1L5llCCV6O9HN09zClIzzeJ8OJ9MpGmIlCxm+pdCkqTwqJ4JcjbojFr79rl2F1mzcoLMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/4.0.1/chart.umd.js" integrity="sha512-gQhCDsnnnUfaRzD8k1L5llCCV6O9HN09zClIzzeJ8OJ9MpGmIlCxm+pdCkqTwqJ4JcjbojFr79rl2F1mzcoLMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||||
|
|||||||
@@ -16,23 +16,23 @@
|
|||||||
<img src="logo.svg" class="me-2" width="35" height="35" alt="Icon">
|
<img src="logo.svg" class="me-2" width="35" height="35" alt="Icon">
|
||||||
<h3 class="text-primary m-0">FA Krosno Manager</h3>
|
<h3 class="text-primary m-0">FA Krosno Manager</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex align-items-center">
|
@* <div class="d-flex align-items-center"> *@
|
||||||
@if (IsAuthenticated)
|
@* @if (IsAuthenticated) *@
|
||||||
{
|
@* { *@
|
||||||
<span class="me-2">Jesteś zalogowany jako <strong>@UserName</strong></span>
|
@* <span class="me-2">Jesteś zalogowany jako <strong>@UserName</strong></span> *@
|
||||||
<SfButton CssClass="e-primary" IsPrimary="true" @onclick="Logout">Wyloguj</SfButton>
|
@* <SfButton CssClass="e-primary" IsPrimary="true" @onclick="Logout">Wyloguj</SfButton> *@
|
||||||
}
|
@* } *@
|
||||||
else
|
@* else *@
|
||||||
{
|
@* { *@
|
||||||
<a href="/login" class="text-muted">Zaloguj</a>
|
@* <a href="/login" class="text-muted">Zaloguj</a> *@
|
||||||
}
|
@* } *@
|
||||||
</div>
|
@* </div> *@
|
||||||
</div>
|
</div>
|
||||||
<div class="row gx-1 flex-grow-1">
|
<div class="row gx-1 flex-grow-1">
|
||||||
<div class="col-auto custom-menu-width">
|
<div class="col-auto custom-menu-width">
|
||||||
<SfMenu TValue="MenuItem" HamburgerMode="true" Orientation="Vertical" Title="Menu">
|
<SfMenu TValue="MenuItem" HamburgerMode="true" Orientation="Vertical" Title="Menu">
|
||||||
<MenuItems>
|
<MenuItems>
|
||||||
<MenuItem Text="Zamówienia DELFOR" Url="/ScheduleOrders" IconCss="fa-solid fa-landmark"></MenuItem>
|
<MenuItem Text="Zamówienia DELFOR" Url="/" IconCss="fa-solid fa-landmark"></MenuItem>
|
||||||
<MenuItem Text="Zamówienia klienta EDI" Url="/EdiCustomerOrders" IconCss="fa-solid fa-list-check"></MenuItem>
|
<MenuItem Text="Zamówienia klienta EDI" Url="/EdiCustomerOrders" IconCss="fa-solid fa-list-check"></MenuItem>
|
||||||
<MenuItem Text="Zamówienia klienta" Url="/CustomerOrders" IconCss="fa-solid fa-database"></MenuItem>
|
<MenuItem Text="Zamówienia klienta" Url="/CustomerOrders" IconCss="fa-solid fa-database"></MenuItem>
|
||||||
@if (UserName == "pkus")
|
@if (UserName == "pkus")
|
||||||
@@ -64,11 +64,11 @@
|
|||||||
|
|
||||||
protected override void OnInitialized()
|
protected override void OnInitialized()
|
||||||
{
|
{
|
||||||
ClaimsPrincipal currentUser = AuthenticationStateProvider.GetCurrentUser();
|
// ClaimsPrincipal currentUser = AuthenticationStateProvider.GetCurrentUser();
|
||||||
IsAuthenticated = currentUser.Identity?.IsAuthenticated == true;
|
// IsAuthenticated = currentUser.Identity?.IsAuthenticated == true;
|
||||||
UserName = currentUser.Identity?.Name ?? "Nieznany użytkownik";
|
// UserName = currentUser.Identity?.Name ?? "Nieznany użytkownik";
|
||||||
|
//
|
||||||
AuthenticationStateProvider.AuthenticationStateChanged += OnAuthenticationStateChanged;
|
// AuthenticationStateProvider.AuthenticationStateChanged += OnAuthenticationStateChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void OnAuthenticationStateChanged(Task<AuthenticationState> task)
|
private async void OnAuthenticationStateChanged(Task<AuthenticationState> task)
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
@page "/Admin/Scheduler"
|
@page "/Admin/Scheduler"
|
||||||
|
|
||||||
@attribute [Authorize]
|
|
||||||
|
|
||||||
@using System.Security.Claims
|
@using System.Security.Claims
|
||||||
@using Microsoft.AspNetCore.Authorization
|
@using Microsoft.AspNetCore.Authorization
|
||||||
@using OrdersManagementDataModel.Dtos
|
@using OrdersManagementDataModel.Dtos
|
||||||
@@ -60,17 +58,17 @@
|
|||||||
{
|
{
|
||||||
if (firstRender)
|
if (firstRender)
|
||||||
{
|
{
|
||||||
ClaimsPrincipal currentUser = CustomAuthenticationStateProvider.GetCurrentUser();
|
// ClaimsPrincipal currentUser = CustomAuthenticationStateProvider.GetCurrentUser();
|
||||||
|
//
|
||||||
if (currentUser.Identity?.IsAuthenticated == false || currentUser.Identity?.Name != "pkus")
|
// if (currentUser.Identity?.IsAuthenticated == false || currentUser.Identity?.Name != "pkus")
|
||||||
{
|
// {
|
||||||
NavigationManager.NavigateTo("/Unauthorized");
|
// NavigationManager.NavigateTo("/Unauthorized");
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
await LoadTasks();
|
await LoadTasks();
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
@page "/admin/UsersManager"
|
@page "/admin/UsersManager"
|
||||||
|
|
||||||
@attribute [Authorize]
|
|
||||||
|
|
||||||
@using System.Security.Claims
|
@using System.Security.Claims
|
||||||
@using Microsoft.AspNetCore.Authorization
|
@using Microsoft.AspNetCore.Authorization
|
||||||
@using OrdersManagementDataModel.Dtos
|
@using OrdersManagementDataModel.Dtos
|
||||||
@@ -136,19 +134,19 @@
|
|||||||
if (firstRender)
|
if (firstRender)
|
||||||
{
|
{
|
||||||
Visibility = false;
|
Visibility = false;
|
||||||
ClaimsPrincipal currentUser = CustomAuthenticationStateProvider.GetCurrentUser();
|
// ClaimsPrincipal currentUser = CustomAuthenticationStateProvider.GetCurrentUser();
|
||||||
|
//
|
||||||
if (currentUser.Identity?.IsAuthenticated == false || currentUser.Identity?.Name != "pkus")
|
// if (currentUser.Identity?.IsAuthenticated == false || currentUser.Identity?.Name != "pkus")
|
||||||
{
|
// {
|
||||||
NavigationManager.NavigateTo("/Unauthorized");
|
// NavigationManager.NavigateTo("/Unauthorized");
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
await LoadUsers();
|
await LoadUsers();
|
||||||
await LoadRoles();
|
await LoadRoles();
|
||||||
//await LoadFunctions();
|
//await LoadFunctions();
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
@page "/CustomerOrder/{CustomerOrderId:guid}"
|
@page "/CustomerOrder/{CustomerOrderId:guid}"
|
||||||
|
|
||||||
@attribute [Authorize]
|
|
||||||
|
|
||||||
@inject CustomerOrderService CustomerOrderService
|
@inject CustomerOrderService CustomerOrderService
|
||||||
@inject ScheduleOrderService ScheduleOrderService
|
@inject ScheduleOrderService ScheduleOrderService
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
@@ -224,14 +222,14 @@
|
|||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
_isVisible = false;
|
_isVisible = false;
|
||||||
|
|
||||||
ClaimsPrincipal currentUser = CustomAuthenticationStateProvider.GetCurrentUser();
|
// ClaimsPrincipal currentUser = CustomAuthenticationStateProvider.GetCurrentUser();
|
||||||
|
//
|
||||||
if (currentUser.Identity?.IsAuthenticated == false)
|
// if (currentUser.Identity?.IsAuthenticated == false)
|
||||||
{
|
// {
|
||||||
NavigationManager.NavigateTo("/Unauthorized");
|
// NavigationManager.NavigateTo("/Unauthorized");
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
CustomerOrderDto? customerOrder = await CustomerOrderService.GetCustomerOrderAsync(CustomerOrderId);
|
CustomerOrderDto? customerOrder = await CustomerOrderService.GetCustomerOrderAsync(CustomerOrderId);
|
||||||
|
|
||||||
if (customerOrder != null)
|
if (customerOrder != null)
|
||||||
@@ -239,7 +237,9 @@
|
|||||||
CustomerOrderDto = customerOrder;
|
CustomerOrderDto = customerOrder;
|
||||||
_customerOrderLines = CustomerOrderDto.CustomerOrderLines.ToList() ?? [];
|
_customerOrderLines = CustomerOrderDto.CustomerOrderLines.ToList() ?? [];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
StateHasChanged();
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
@page "/CustomerOrders"
|
@page "/CustomerOrders"
|
||||||
|
|
||||||
@attribute [Authorize]
|
|
||||||
|
|
||||||
@inject CustomerOrderService CustomerOrderService
|
@inject CustomerOrderService CustomerOrderService
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
@inject CustomAuthenticationStateProvider CustomAuthenticationStateProvider
|
@inject CustomAuthenticationStateProvider CustomAuthenticationStateProvider
|
||||||
@@ -91,19 +89,19 @@
|
|||||||
{
|
{
|
||||||
if (firstRender)
|
if (firstRender)
|
||||||
{
|
{
|
||||||
ClaimsPrincipal currentUser = CustomAuthenticationStateProvider.GetCurrentUser();
|
// ClaimsPrincipal currentUser = CustomAuthenticationStateProvider.GetCurrentUser();
|
||||||
|
//
|
||||||
if (currentUser.Identity?.IsAuthenticated == false)
|
// if (currentUser.Identity?.IsAuthenticated == false)
|
||||||
{
|
// {
|
||||||
NavigationManager.NavigateTo("/Unauthorized");
|
// NavigationManager.NavigateTo("/Unauthorized");
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
_customerOrders = await CustomerOrderService.GetCustomerOrdersAsync() ?? new List<CustomerOrderDto>();
|
_customerOrders = await CustomerOrderService.GetCustomerOrdersAsync() ?? new List<CustomerOrderDto>();
|
||||||
_customerOrders = _customerOrders.OrderByDescending(x => x.CreateDate).ToList();
|
_customerOrders = _customerOrders.OrderByDescending(x => x.CreateDate).ToList();
|
||||||
|
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
@page "/EdiCustomerOrder/{CustomerOrderId:guid}"
|
@page "/EdiCustomerOrder/{CustomerOrderId:guid}"
|
||||||
|
|
||||||
@attribute [Authorize]
|
|
||||||
|
|
||||||
@inject EdiCustomerOrderService EdiCustomerOrderService
|
@inject EdiCustomerOrderService EdiCustomerOrderService
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
@inject CustomAuthenticationStateProvider CustomAuthenticationStateProvider
|
@inject CustomAuthenticationStateProvider CustomAuthenticationStateProvider
|
||||||
@@ -197,19 +195,20 @@
|
|||||||
{
|
{
|
||||||
if (firstRender)
|
if (firstRender)
|
||||||
{
|
{
|
||||||
ClaimsPrincipal currentUser = CustomAuthenticationStateProvider.GetCurrentUser();
|
// ClaimsPrincipal currentUser = CustomAuthenticationStateProvider.GetCurrentUser();
|
||||||
|
//
|
||||||
if (currentUser.Identity?.IsAuthenticated == false)
|
// if (currentUser.Identity?.IsAuthenticated == false)
|
||||||
{
|
// {
|
||||||
NavigationManager.NavigateTo("/Unauthorized");
|
// NavigationManager.NavigateTo("/Unauthorized");
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
EdiCustomerOrderDto? ediCustomerOrder = await EdiCustomerOrderService.GetEdiCustomerOrderAsync(CustomerOrderId);
|
EdiCustomerOrderDto? ediCustomerOrder = await EdiCustomerOrderService.GetEdiCustomerOrderAsync(CustomerOrderId);
|
||||||
|
|
||||||
EdiCustomerOrderDto = ediCustomerOrder;
|
EdiCustomerOrderDto = ediCustomerOrder;
|
||||||
_ediCustomerOrderLines = ediCustomerOrder?.EdiCustomerOrderLines.ToList() ?? [];
|
_ediCustomerOrderLines = ediCustomerOrder?.EdiCustomerOrderLines.ToList() ?? [];
|
||||||
}
|
StateHasChanged();
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
@page "/EdiCustomerOrders"
|
@page "/EdiCustomerOrders"
|
||||||
|
|
||||||
@attribute [Authorize]
|
|
||||||
|
|
||||||
@inject EdiCustomerOrderService EdiCustomerOrderService
|
@inject EdiCustomerOrderService EdiCustomerOrderService
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
@inject CustomAuthenticationStateProvider CustomAuthenticationStateProvider
|
@inject CustomAuthenticationStateProvider CustomAuthenticationStateProvider
|
||||||
@@ -34,7 +32,7 @@
|
|||||||
{
|
{
|
||||||
<div class="row mb-4">
|
<div class="row mb-4">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<SfButton CssClass="btn-primary" @onclick="SendOrderToSyteLine">@_text</SfButton>
|
<SfButton CssClass="e-primary" IsPrimary="true" @onclick="SendOrderToSyteLine">@_text</SfButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@@ -146,16 +144,16 @@
|
|||||||
{
|
{
|
||||||
if (firstRender)
|
if (firstRender)
|
||||||
{
|
{
|
||||||
ClaimsPrincipal currentUser = CustomAuthenticationStateProvider.GetCurrentUser();
|
// ClaimsPrincipal currentUser = CustomAuthenticationStateProvider.GetCurrentUser();
|
||||||
|
//
|
||||||
if (currentUser.Identity?.IsAuthenticated == false)
|
// if (currentUser.Identity?.IsAuthenticated == false)
|
||||||
{
|
// {
|
||||||
NavigationManager.NavigateTo("/Unauthorized");
|
// NavigationManager.NavigateTo("/Unauthorized");
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
await LoadData();
|
await LoadData();
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
@page "/login"
|
@page "/login"
|
||||||
|
|
||||||
@attribute [AllowAnonymous]
|
|
||||||
|
|
||||||
@using Microsoft.AspNetCore.Authorization
|
@using Microsoft.AspNetCore.Authorization
|
||||||
@using OrdersManagement.Models
|
@using OrdersManagement.Models
|
||||||
@using Syncfusion.Blazor.Inputs
|
@using Syncfusion.Blazor.Inputs
|
||||||
@@ -79,7 +77,7 @@
|
|||||||
}
|
}
|
||||||
</CardContent>
|
</CardContent>
|
||||||
<CardFooter>
|
<CardFooter>
|
||||||
<small class="text-muted">Orders Management System © @(DateTime.Now.Year)</small>
|
<small class="text-muted">FA Krosno Manager © @(DateTime.Now.Year)</small>
|
||||||
</CardFooter>
|
</CardFooter>
|
||||||
</SfCard>
|
</SfCard>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
@page "/"
|
@page "/Main"
|
||||||
@using Microsoft.AspNetCore.Authorization
|
@using Microsoft.AspNetCore.Authorization
|
||||||
|
|
||||||
@attribute [AllowAnonymous]
|
|
||||||
|
|
||||||
@inject CustomAuthenticationStateProvider CustomAuthenticationStateProvider
|
@inject CustomAuthenticationStateProvider CustomAuthenticationStateProvider
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
@page "/ScheduleOrder/{ScheduleOrderId:int}"
|
@page "/ScheduleOrder/{ScheduleOrderId:int}"
|
||||||
@attribute [Authorize]
|
|
||||||
|
|
||||||
@using System.Security.Claims
|
@using System.Security.Claims
|
||||||
@using Microsoft.AspNetCore.Authorization
|
@using Microsoft.AspNetCore.Authorization
|
||||||
@@ -128,14 +127,14 @@
|
|||||||
{
|
{
|
||||||
if (firstRender)
|
if (firstRender)
|
||||||
{
|
{
|
||||||
ClaimsPrincipal currentUser = CustomAuthenticationStateProvider.GetCurrentUser();
|
// ClaimsPrincipal currentUser = CustomAuthenticationStateProvider.GetCurrentUser();
|
||||||
|
//
|
||||||
if (currentUser.Identity?.IsAuthenticated == false)
|
// if (currentUser.Identity?.IsAuthenticated == false)
|
||||||
{
|
// {
|
||||||
NavigationManager.NavigateTo("/Unauthorized");
|
// NavigationManager.NavigateTo("/Unauthorized");
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
ScheduleOrderDto = await ScheduleOrderService.GetScheduleOrderAsync(ScheduleOrderId);
|
ScheduleOrderDto = await ScheduleOrderService.GetScheduleOrderAsync(ScheduleOrderId);
|
||||||
|
|
||||||
_scheduleOrderDetails = ScheduleOrderDto?.ScheduleOrderDetails;
|
_scheduleOrderDetails = ScheduleOrderDto?.ScheduleOrderDetails;
|
||||||
@@ -149,7 +148,7 @@
|
|||||||
scheduleOrderDetailDto.RecipientName = ScheduleOrderDto?.RecipientName;
|
scheduleOrderDetailDto.RecipientName = ScheduleOrderDto?.RecipientName;
|
||||||
scheduleOrderDetailDto.PurchaserName = ScheduleOrderDto?.PurchaserCode;
|
scheduleOrderDetailDto.PurchaserName = ScheduleOrderDto?.PurchaserCode;
|
||||||
}
|
}
|
||||||
}
|
// }
|
||||||
|
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
@page "/ScheduleOrders"
|
@page "/"
|
||||||
|
|
||||||
@attribute [Authorize]
|
|
||||||
|
|
||||||
@using System.Security.Claims
|
@using System.Security.Claims
|
||||||
@using Microsoft.AspNetCore.Authorization
|
@using Microsoft.AspNetCore.Authorization
|
||||||
@@ -20,17 +18,17 @@
|
|||||||
{
|
{
|
||||||
if (firstRender)
|
if (firstRender)
|
||||||
{
|
{
|
||||||
ClaimsPrincipal currentUser = CustomAuthenticationStateProvider.GetCurrentUser();
|
// ClaimsPrincipal currentUser = CustomAuthenticationStateProvider.GetCurrentUser();
|
||||||
|
//
|
||||||
if (currentUser.Identity?.IsAuthenticated == false)
|
// if (currentUser.Identity?.IsAuthenticated == false)
|
||||||
{
|
// {
|
||||||
NavigationManager.NavigateTo("/Unauthorized");
|
// NavigationManager.NavigateTo("/Unauthorized");
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
_scheduleOrders = await FetchScheduleOrdersAsync();
|
_scheduleOrders = await FetchScheduleOrdersAsync();
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -95,7 +95,7 @@
|
|||||||
</SfGrid>
|
</SfGrid>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
<CardFooter>
|
<CardFooter>
|
||||||
<small class="text-muted">Orders Management System © @(DateTime.Now.Year)</small>
|
<small class="text-muted">FA Krosno Manager © @(DateTime.Now.Year)</small>
|
||||||
</CardFooter>
|
</CardFooter>
|
||||||
</SfCard>
|
</SfCard>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
@page "/Unauthorized"
|
@page "/Unauthorized"
|
||||||
@using Microsoft.AspNetCore.Authorization
|
@using Microsoft.AspNetCore.Authorization
|
||||||
|
|
||||||
@attribute [AllowAnonymous]
|
|
||||||
|
|
||||||
@using Syncfusion.Blazor.Cards
|
@using Syncfusion.Blazor.Cards
|
||||||
@using Syncfusion.Blazor.Buttons
|
@using Syncfusion.Blazor.Buttons
|
||||||
|
|
||||||
@@ -22,7 +20,7 @@
|
|||||||
</SfButton>
|
</SfButton>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
<CardFooter>
|
<CardFooter>
|
||||||
<small class="text-muted">Orders Management System © @(DateTime.Now.Year)</small>
|
<small class="text-muted">FA Krosno Manager © @(DateTime.Now.Year)</small>
|
||||||
</CardFooter>
|
</CardFooter>
|
||||||
</SfCard>
|
</SfCard>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public class ServiceBase<T> where T : class
|
|||||||
|
|
||||||
protected async Task<IEnumerable<T>?> GetListAsync(string request)
|
protected async Task<IEnumerable<T>?> GetListAsync(string request)
|
||||||
{
|
{
|
||||||
Configure();
|
//Configure();
|
||||||
|
|
||||||
var response = await _httpClient.GetAsync(request);
|
var response = await _httpClient.GetAsync(request);
|
||||||
response.EnsureSuccessStatusCode();
|
response.EnsureSuccessStatusCode();
|
||||||
@@ -24,7 +24,7 @@ public class ServiceBase<T> where T : class
|
|||||||
|
|
||||||
protected async Task<T?> GetEntityAsync(string request)
|
protected async Task<T?> GetEntityAsync(string request)
|
||||||
{
|
{
|
||||||
Configure();
|
//Configure();
|
||||||
|
|
||||||
var response = await _httpClient.GetAsync(request);
|
var response = await _httpClient.GetAsync(request);
|
||||||
response.EnsureSuccessStatusCode();
|
response.EnsureSuccessStatusCode();
|
||||||
@@ -33,7 +33,7 @@ public class ServiceBase<T> where T : class
|
|||||||
|
|
||||||
protected async Task<HttpResponseMessage> PostAsync(string request)
|
protected async Task<HttpResponseMessage> PostAsync(string request)
|
||||||
{
|
{
|
||||||
Configure();
|
//Configure();
|
||||||
|
|
||||||
var response = await _httpClient.PostAsync(request, null);
|
var response = await _httpClient.PostAsync(request, null);
|
||||||
response.EnsureSuccessStatusCode();
|
response.EnsureSuccessStatusCode();
|
||||||
@@ -42,7 +42,7 @@ public class ServiceBase<T> where T : class
|
|||||||
|
|
||||||
protected async Task<HttpResponseMessage> PostAsJsonAsync(string request, T obj)
|
protected async Task<HttpResponseMessage> PostAsJsonAsync(string request, T obj)
|
||||||
{
|
{
|
||||||
Configure();
|
//Configure();
|
||||||
|
|
||||||
var response = await _httpClient.PostAsJsonAsync(request, obj);
|
var response = await _httpClient.PostAsJsonAsync(request, obj);
|
||||||
response.EnsureSuccessStatusCode();
|
response.EnsureSuccessStatusCode();
|
||||||
@@ -51,7 +51,7 @@ public class ServiceBase<T> where T : class
|
|||||||
|
|
||||||
protected async Task<HttpResponseMessage> PostAsJsonAsync(string request, object obj)
|
protected async Task<HttpResponseMessage> PostAsJsonAsync(string request, object obj)
|
||||||
{
|
{
|
||||||
Configure();
|
//Configure();
|
||||||
|
|
||||||
var response = await _httpClient.PostAsJsonAsync(request, obj);
|
var response = await _httpClient.PostAsJsonAsync(request, obj);
|
||||||
response.EnsureSuccessStatusCode();
|
response.EnsureSuccessStatusCode();
|
||||||
@@ -60,7 +60,7 @@ public class ServiceBase<T> where T : class
|
|||||||
|
|
||||||
protected async Task<HttpResponseMessage> PutAsJsonAsync(string request, T obj)
|
protected async Task<HttpResponseMessage> PutAsJsonAsync(string request, T obj)
|
||||||
{
|
{
|
||||||
Configure();
|
//Configure();
|
||||||
|
|
||||||
var response = await _httpClient.PutAsJsonAsync(request, obj);
|
var response = await _httpClient.PutAsJsonAsync(request, obj);
|
||||||
response.EnsureSuccessStatusCode();
|
response.EnsureSuccessStatusCode();
|
||||||
@@ -69,7 +69,7 @@ public class ServiceBase<T> where T : class
|
|||||||
|
|
||||||
protected async Task<HttpResponseMessage> DeleteAsync(string request)
|
protected async Task<HttpResponseMessage> DeleteAsync(string request)
|
||||||
{
|
{
|
||||||
Configure();
|
//Configure();
|
||||||
|
|
||||||
var response = await _httpClient.DeleteAsync(request);
|
var response = await _httpClient.DeleteAsync(request);
|
||||||
response.EnsureSuccessStatusCode();
|
response.EnsureSuccessStatusCode();
|
||||||
|
|||||||
Reference in New Issue
Block a user