1
0
mirror of synced 2024-12-11 06:16:01 +01:00
TaikoLocalServer/TaikoWebUI/Pages/ChangePassword.razor
2024-05-16 23:32:46 +01:00

52 lines
2.9 KiB
Plaintext

@inject HttpClient Client
@inject IDialogService DialogService
@inject AuthService AuthService
@inject NavigationManager NavigationManager
@page "/ChangePassword"
@if (AuthService.OnlyAdmin || !AuthService.LoginRequired)
{
NavigationManager.NavigateTo("/");
}
else
{
if (AuthService.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">@Localizer["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=@Localizer["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=@Localizer["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=@Localizer["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=@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>
</div>
</MudForm>
</MudCardContent>
</MudCard>
</MudItem>
</MudGrid>
</MudContainer>
}
else
{
NavigationManager.NavigateTo("/");
}
}