-
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
1 parent
7badc6e
commit 34de312
Showing
7 changed files
with
184 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
@page "/generate-wallet" | ||
@inherits MvvmComponentBase<MainViewModel> | ||
@inject ISnackbar Snackbar | ||
|
||
<PageTitle>Generate Wallet - @Program.PageTitlePostFix</PageTitle> | ||
|
||
<MudContainer Class="mt-2 px-8" MaxWidth="MaxWidth.False"> | ||
<MudBreadcrumbs Class="breadcrumbs-aoww" Items="_items"></MudBreadcrumbs> | ||
|
||
@if (BindingContext.SecretKey == null) | ||
{ | ||
<MudPaper Class="pa-4 mt-4" Elevation="3"> | ||
<MudText Typo="Typo.h4" Class="mb-4">Generate Wallet</MudText> | ||
<MudText Typo="Typo.body1" Class="mb-4">Enter a password to encrypt your wallet. The password must be at least 6 characters long.</MudText> | ||
|
||
<MudTextField @bind-Value="Password" | ||
Label="Password" | ||
Variant="Variant.Outlined" | ||
InputType="@PasswordInput" | ||
Adornment="Adornment.End" | ||
AdornmentIcon="@PasswordInputIcon" | ||
OnAdornmentClick="TogglePasswordVisibility" | ||
/> | ||
|
||
<MudTextField @bind-Value="ConfirmPassword" | ||
Label="Confirm Password" | ||
Variant="Variant.Outlined" | ||
InputType="@PasswordInput" | ||
Adornment="Adornment.End" | ||
AdornmentIcon="@PasswordInputIcon" | ||
OnAdornmentClick="TogglePasswordVisibility" | ||
/> | ||
|
||
<MudButton Variant="Variant.Filled" | ||
Color="Color.Primary" | ||
OnClick="GenerateWallet" | ||
Class="mt-4"> | ||
Generate Wallet | ||
</MudButton> | ||
</MudPaper> | ||
} | ||
else | ||
{ | ||
<AddGenerateWalletComponent /> | ||
} | ||
</MudContainer> | ||
|
||
@code { | ||
private List<BreadcrumbItem> _items = new List<BreadcrumbItem> | ||
{ | ||
new BreadcrumbItem("Home", href: "/"), | ||
new BreadcrumbItem("Generate Wallet", href: null, disabled: true) | ||
}; | ||
} |
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,57 @@ | ||
using aoWebWallet.ViewModels; | ||
using Microsoft.AspNetCore.Components; | ||
using MudBlazor; | ||
|
||
namespace aoWebWallet.Pages | ||
{ | ||
public partial class GenerateWalletPage : MvvmComponentBase<MainViewModel> | ||
{ | ||
private string Password { get; set; } = string.Empty; | ||
private string ConfirmPassword { get; set; } = string.Empty; | ||
private bool PasswordVisible { get; set; } = false; | ||
private InputType PasswordInput { get; set; } = InputType.Password; | ||
private string PasswordInputIcon { get; set; } = Icons.Material.Filled.VisibilityOff; | ||
|
||
private void TogglePasswordVisibility() | ||
{ | ||
if (PasswordVisible) | ||
{ | ||
PasswordVisible = false; | ||
PasswordInputIcon = Icons.Material.Filled.VisibilityOff; | ||
PasswordInput = InputType.Password; | ||
} | ||
else | ||
{ | ||
PasswordVisible = true; | ||
PasswordInputIcon = Icons.Material.Filled.Visibility; | ||
PasswordInput = InputType.Text; | ||
} | ||
} | ||
|
||
private void GenerateWallet() | ||
{ | ||
if (string.IsNullOrWhiteSpace(Password) || string.IsNullOrWhiteSpace(ConfirmPassword)) | ||
{ | ||
Snackbar.Add("Please enter and confirm your password.", Severity.Warning); | ||
return; | ||
} | ||
|
||
if (Password != ConfirmPassword) | ||
{ | ||
Snackbar.Add("Passwords do not match.", Severity.Error); | ||
return; | ||
} | ||
|
||
if (Password.Length < 6) | ||
{ | ||
Snackbar.Add("Password must be at least 6 characters long.", Severity.Warning); | ||
return; | ||
} | ||
|
||
BindingContext.SecretKey = Password; | ||
|
||
// TODO: Implement wallet generation logic here | ||
Snackbar.Add("Wallet generated successfully!", Severity.Success); | ||
} | ||
} | ||
} |
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
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