2023-10-16 11:38:27 +02:00
|
|
|
@inject HttpClient Client
|
|
|
|
@inject IDialogService DialogService
|
2024-05-17 00:32:46 +02:00
|
|
|
@inject AuthService AuthService
|
2023-10-16 11:38:27 +02:00
|
|
|
@inject NavigationManager NavigationManager
|
2024-08-13 17:07:39 +02:00
|
|
|
@inject BreadcrumbsStateContainer BreadcrumbsStateContainer
|
2023-10-16 11:38:27 +02:00
|
|
|
|
2024-03-09 07:07:34 +01:00
|
|
|
@page "/ChangePassword"
|
2023-10-16 11:38:27 +02:00
|
|
|
|
2024-05-17 00:32:46 +02:00
|
|
|
@if (AuthService.OnlyAdmin || !AuthService.LoginRequired)
|
2023-10-16 11:38:27 +02:00
|
|
|
{
|
2024-03-09 07:07:34 +01:00
|
|
|
NavigationManager.NavigateTo("/");
|
2023-10-16 11:38:27 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2024-05-17 00:32:46 +02:00
|
|
|
if (AuthService.IsLoggedIn)
|
2024-03-09 07:07:34 +01:00
|
|
|
{
|
|
|
|
<MudContainer>
|
|
|
|
<MudGrid Justify="Justify.Center">
|
|
|
|
<MudItem xs="12" md="6" lg="4" class="mt-8">
|
|
|
|
<MudCard Elevation="0" Outlined="true">
|
|
|
|
<MudCardContent>
|
|
|
|
<MudForm @ref="changePasswordForm">
|
2024-05-01 17:13:47 +02:00
|
|
|
<MudText Typo="Typo.h5" Class="mb-4">@Localizer["Change Password"]</MudText>
|
2024-03-09 07:07:34 +01:00
|
|
|
<div style="display:flex;flex-direction:column;gap:15px;">
|
|
|
|
<MudTextField @bind-value="cardNum" InputType="InputType.Text" T="string"
|
|
|
|
FullWidth="true" Required="@true" RequiredError="Access code is required"
|
2024-05-01 17:13:47 +02:00
|
|
|
Label=@Localizer["Access Code"] Variant="Variant.Outlined" Margin="Margin.Dense" />
|
2024-03-09 07:07:34 +01:00
|
|
|
<MudTextField @bind-Value="oldPassword" InputType="InputType.Password"
|
|
|
|
T="string" FullWidth="true" Required="@true"
|
|
|
|
RequiredError="Old Password is required"
|
2024-05-01 17:13:47 +02:00
|
|
|
Label=@Localizer["Old Password"] Variant="Variant.Outlined" Margin="Margin.Dense" />
|
2024-03-09 07:07:34 +01:00
|
|
|
<MudTextField @bind-Value="newPassword" InputType="InputType.Password"
|
|
|
|
T="string" FullWidth="true" Required="@true"
|
|
|
|
RequiredError="Password is required"
|
2024-05-01 17:13:47 +02:00
|
|
|
Label=@Localizer["New Password"] Variant="Variant.Outlined" Margin="Margin.Dense" />
|
2024-03-09 07:07:34 +01:00
|
|
|
<MudTextField @bind-Value="confirmNewPassword" InputType="InputType.Password"
|
|
|
|
T="string" FullWidth="true" Required="@true"
|
|
|
|
RequiredError="Confirm password is required"
|
2024-05-01 17:13:47 +02:00
|
|
|
Label=@Localizer["Confirm New Password"] Variant="Variant.Outlined" Margin="Margin.Dense" />
|
|
|
|
<MudButton OnClick="OnChangePassword" FullWidth="true" Class="mt-3" StartIcon="@Icons.Material.Filled.Edit" Color="Color.Primary" Variant="Variant.Filled">@Localizer["Change Password"]</MudButton>
|
2024-03-09 07:07:34 +01:00
|
|
|
</div>
|
|
|
|
</MudForm>
|
|
|
|
</MudCardContent>
|
|
|
|
</MudCard>
|
|
|
|
</MudItem>
|
|
|
|
</MudGrid>
|
|
|
|
</MudContainer>
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
NavigationManager.NavigateTo("/");
|
|
|
|
}
|
2023-10-16 11:38:27 +02:00
|
|
|
}
|