finalizare 1.0
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
@page "/reset-password"
|
||||
@inject IAuthenticationService AuthenticationService
|
||||
@inject NavigationManager Navigation
|
||||
@layout AuthLayout
|
||||
|
||||
<h3>Reset Password</h3>
|
||||
|
||||
@if (!string.IsNullOrEmpty(_errorMessage))
|
||||
{
|
||||
<div class="alert alert-danger mt-2">@_errorMessage</div>
|
||||
}
|
||||
|
||||
<EditForm Model="_resetPasswordModel" OnValidSubmit="HandleResetPassword">
|
||||
<div class="form-group">
|
||||
<label>Email:</label>
|
||||
<InputText class="form-control" @bind-Value="_resetPasswordModel.Email"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>New Password:</label>
|
||||
<InputText class="form-control" @bind-Value="_resetPasswordModel.Password" type="password"/>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Reset Password</button>
|
||||
</EditForm>
|
||||
|
||||
@code {
|
||||
private readonly ResetPasswordModel _resetPasswordModel = new();
|
||||
private string _errorMessage = string.Empty;
|
||||
|
||||
private async Task HandleResetPassword()
|
||||
{
|
||||
_errorMessage = string.Empty;
|
||||
var response = await AuthenticationService.ResetPassword(_resetPasswordModel);
|
||||
|
||||
if (response.StatusCode == 200)
|
||||
{
|
||||
Navigation.NavigateTo("/login", true);
|
||||
}
|
||||
else
|
||||
{
|
||||
_errorMessage = response.Message; // Display error message
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user