2023-10-16 11:38:27 +02:00
|
|
|
@inject HttpClient Client
|
|
|
|
@inject IDialogService DialogService
|
|
|
|
@inject LoginService LoginService
|
|
|
|
@inject NavigationManager NavigationManager
|
|
|
|
|
2024-03-09 07:07:34 +01:00
|
|
|
@page "/ChangePassword"
|
2023-10-16 11:38:27 +02:00
|
|
|
|
|
|
|
@if (LoginService.OnlyAdmin || !LoginService.LoginRequired)
|
|
|
|
{
|
2024-03-09 07:07:34 +01:00
|
|
|
NavigationManager.NavigateTo("/");
|
2023-10-16 11:38:27 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2024-03-09 07:07:34 +01:00
|
|
|
if (LoginService.IsLoggedIn)
|
|
|
|
{
|
|
|
|
<MudContainer>
|
|
|
|
<MudGrid Justify="Justify.Center">
|
|
|
|
<MudItem xs="12" md="6" lg="4" class="mt-8">
|
|
|
|
<MudCard Elevation="0" Outlined="true">
|
|
|
|
<MudCardContent>
|
|
|
|
<MudForm @ref="changePasswordForm">
|
|
|
|
<MudText Typo="Typo.h5" Class="mb-4">Change Password</MudText>
|
|
|
|
<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"
|
|
|
|
Label="Access Code" Variant="Variant.Outlined" Margin="Margin.Dense" />
|
|
|
|
<MudTextField @bind-Value="oldPassword" InputType="InputType.Password"
|
|
|
|
T="string" FullWidth="true" Required="@true"
|
|
|
|
RequiredError="Old Password is required"
|
|
|
|
Label="Old Password" Variant="Variant.Outlined" Margin="Margin.Dense" />
|
|
|
|
<MudTextField @bind-Value="newPassword" InputType="InputType.Password"
|
|
|
|
T="string" FullWidth="true" Required="@true"
|
|
|
|
RequiredError="Password is required"
|
|
|
|
Label="New Password" Variant="Variant.Outlined" Margin="Margin.Dense" />
|
|
|
|
<MudTextField @bind-Value="confirmNewPassword" InputType="InputType.Password"
|
|
|
|
T="string" FullWidth="true" Required="@true"
|
|
|
|
RequiredError="Confirm password is required"
|
|
|
|
Label="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">Change password</MudButton>
|
|
|
|
</div>
|
|
|
|
</MudForm>
|
|
|
|
</MudCardContent>
|
|
|
|
</MudCard>
|
|
|
|
</MudItem>
|
|
|
|
</MudGrid>
|
|
|
|
</MudContainer>
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
NavigationManager.NavigateTo("/");
|
|
|
|
}
|
2023-10-16 11:38:27 +02:00
|
|
|
}
|