@inherits AliasVault.Client.Auth.Pages.Base.LoginBase @layout Auth.Layout.EmptyLayout @attribute [AllowAnonymous] @using System.Text.Json @using AliasVault.Client.Utilities @using AliasVault.Cryptography.Client @using AliasVault.Shared.Models.WebApi.Auth @using SecureRemotePassword
@if (IsLoading) {
}
@code { /// /// The username to use for the new account. /// [Parameter] public string Username { get; set; } = string.Empty; /// /// The password to use for the new account. /// [Parameter] public string Password { get; set; } = string.Empty; private bool IsLoading { get; set; } = true; /// protected override async Task OnAfterRenderAsync(bool firstRender) { await base.OnAfterRenderAsync(firstRender); if (firstRender) { await CompleteSetup(); } } private async Task CompleteSetup() { StateHasChanged(); var (success, errorMessage) = await UserRegistrationService.RegisterUserAsync(Username, Password); if (success) { NavigationManager.NavigateTo("/"); } else { IsLoading = false; GlobalNotificationService.AddErrorMessage(errorMessage ?? "An error occurred during registration.", true); StateHasChanged(); } } }