-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
73 changed files
with
3,922 additions
and
441 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
@page "/changepassword" | ||
@page "/changepassword/{id:int}" | ||
@layout MainLayout | ||
@inject IUserAccountService UserAccountService | ||
@inject IJSRuntime JsRuntime | ||
@inject NavigationManager NavigationManager | ||
@using BlazorPwaApp.Shared.Dto | ||
@using BlazorPwaApp.Shared.Entities | ||
|
||
<PageTitle>Change Password</PageTitle> | ||
<h3 class="text-center fw-bold">Change Password</h3> | ||
|
||
<div class="row justify-content-center"> | ||
<div class="col-md-10"> | ||
|
||
@if (!string.IsNullOrEmpty(ErrorMessage)) | ||
{ | ||
<p class="text-danger">@ErrorMessage</p> | ||
} | ||
|
||
<div class="card"> | ||
<div class="card-header"> | ||
<Span>Change Password</Span> | ||
</div> | ||
<div class="card-body ps-5 pe-5"> | ||
|
||
<EditForm Model="changePassword" OnSubmit="HandleSubmit"> | ||
<DataAnnotationsValidator /> | ||
|
||
<div class="form-group row mt-3"> | ||
<label class="control-label col-md-12 required">User Name</label> | ||
<div class="col"> | ||
<InputText class="form-control" @bind-Value="changePassword.Username" /> | ||
<ValidationMessage For="@(() => changePassword.Username)" /> | ||
</div> | ||
</div> | ||
|
||
<div class="form-group row mt-3"> | ||
<label class="control-label col-md-12 required">Old Password</label> | ||
<div class="col"> | ||
<InputText type="password" class="form-control" @bind-Value="changePassword.Password"></InputText> | ||
<ValidationMessage For="@(() => changePassword.Password)" /> | ||
</div> | ||
</div> | ||
|
||
<div class="form-group row mt-3"> | ||
<label class="control-label col-md-12 required">Password</label> | ||
<div class="col"> | ||
<InputText type="password" class="form-control" @bind-Value="changePassword.NewPassword"></InputText> | ||
<ValidationMessage For="@(() => changePassword.NewPassword)" /> | ||
</div> | ||
</div> | ||
|
||
<div class="form-group row mt-3"> | ||
<label class="control-label col-md-12 required">Confirm Password</label> | ||
<div class="col"> | ||
<InputText type="password" class="form-control" @bind-Value="changePassword.ConfirmPassword"></InputText> | ||
<ValidationMessage For="@(() => changePassword.ConfirmPassword)" /> | ||
</div> | ||
</div> | ||
|
||
<div class="form-group mb-4 mt-4" align="center"> | ||
<button type="submit" class="btn btn-primary">Submit</button> | ||
<button type="button" class="btn btn-danger mx-2" @onclick="GoToUserAccountPage">Back</button> | ||
</div> | ||
</EditForm> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
@code { | ||
[Parameter] | ||
public int? Id { get; set; } | ||
|
||
string btnText = string.Empty; | ||
string ErrorMessage = string.Empty; | ||
|
||
private ChangedPasswordDto changePassword = new ChangedPasswordDto(); | ||
|
||
async Task HandleSubmit() | ||
{ | ||
try | ||
{ | ||
await UserAccountService.ChangePassword(changePassword); | ||
|
||
await JsRuntime.InvokeVoidAsync("alert", "Password changed successfully!"); | ||
NavigationManager.NavigateTo("countries"); | ||
} | ||
catch (ApiException ex) | ||
{ | ||
ErrorMessage = ex.Message; | ||
} | ||
} | ||
|
||
private void GoToUserAccountPage() | ||
{ | ||
NavigationManager.NavigateTo("/login"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
@page "/counter" | ||
@layout MainLayout | ||
|
||
<PageTitle>Counter</PageTitle> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.