Update user registration flow to show correct error messages (#1006)

This commit is contained in:
Leendert de Borst
2025-07-14 12:44:27 +02:00
committed by Leendert de Borst
parent 7621be4cbe
commit c90c5a9f2f
2 changed files with 6 additions and 3 deletions

View File

@@ -187,7 +187,7 @@
{
_isValidating = false;
_isValid = false;
_errorMessage = Localizer["ConfirmPasswordPrompt"];
_errorMessage = string.Empty;
await OnPasswordChange.InvokeAsync(string.Empty);
StateHasChanged();
return;

View File

@@ -1,4 +1,5 @@
@inherits AliasVault.Client.Auth.Pages.Base.LoginBase
@using AliasVault.Client.Utilities
@using Microsoft.Extensions.Localization
@using System.Timers
@@ -51,6 +52,8 @@
@code {
private IStringLocalizer Localizer => LocalizerFactory.Create("Components.Auth.Setup.UsernameStep", "AliasVault.Client");
private IStringLocalizer ApiErrorLocalizer => LocalizerFactory.Create("ApiErrors", "AliasVault.Client");
/// <summary>
/// The username that is previously entered by the user. When a user navigates with back/continue
/// and entered a username already, the existing username might be provided by the parent component.
@@ -181,8 +184,8 @@
}
else
{
var error = await response.Content.ReadAsStringAsync();
_errorMessage = error;
var errorResponse = await response.Content.ReadAsStringAsync();
_errorMessage = ApiResponseUtility.ParseSingleErrorResponse(errorResponse, ApiErrorLocalizer);
_isValid = false;
await OnUsernameChange.InvokeAsync(string.Empty);
}