2025-06-22 00:00:58 +02:00
|
|
|
@using LANCommander.SDK.Exceptions
|
2025-01-05 21:09:57 -06:00
|
|
|
@using LANCommander.SDK.Models
|
2025-12-31 20:01:04 -06:00
|
|
|
@namespace LANCommander.Launcher.UI
|
2025-01-18 20:25:39 -06:00
|
|
|
@inject AuthenticationService AuthenticationService
|
2025-12-31 20:01:04 -06:00
|
|
|
@inject IConnectionClient ConnectionClient
|
2025-01-05 21:09:57 -06:00
|
|
|
@inject NavigationManager NavigationManager
|
|
|
|
|
@inject IMessageService MessageService
|
|
|
|
|
@inject ILogger<RegistrationForm> Logger
|
2025-02-06 20:54:03 -06:00
|
|
|
@inject ImportManagerService ImportManagerService
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
@inject LocalizationService LocalizationService
|
2025-01-05 21:09:57 -06:00
|
|
|
|
2025-01-20 12:10:30 -06:00
|
|
|
<PageHeader OnBack="OnBack">
|
2025-01-05 21:09:57 -06:00
|
|
|
<TitleTemplate>
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
@LocalizationService.GetString("Register")
|
2025-01-05 21:09:57 -06:00
|
|
|
</TitleTemplate>
|
|
|
|
|
</PageHeader>
|
|
|
|
|
<Form Model="@Model" Loading="@Loading" Layout="FormLayout.Vertical" OnFinish="OnFinish">
|
2025-06-22 00:00:58 +02:00
|
|
|
|
|
|
|
|
@foreach (var item in Errors)
|
|
|
|
|
{
|
|
|
|
|
<Alert Message="@item" Type="AlertType.Error" ShowIcon="true" Style="margin-bottom: 8px;" />
|
|
|
|
|
}
|
|
|
|
|
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
<FormItem Label="@LocalizationService.GetString("ServerAddress")">
|
2025-01-20 12:10:30 -06:00
|
|
|
<Input Value="ServerAddress" Disabled />
|
2025-01-05 21:09:57 -06:00
|
|
|
</FormItem>
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
<FormItem Label="@LocalizationService.GetString("Username")">
|
2025-02-23 09:02:48 -06:00
|
|
|
<Input @bind-Value="@context.UserName" AutoFocus />
|
2025-01-05 21:09:57 -06:00
|
|
|
</FormItem>
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
<FormItem Label="@LocalizationService.GetString("Password")">
|
2025-01-05 21:09:57 -06:00
|
|
|
<InputPassword @bind-Value="@context.Password"/>
|
|
|
|
|
</FormItem>
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
<FormItem Label="@LocalizationService.GetString("ConfirmPassword")">
|
2025-01-05 21:09:57 -06:00
|
|
|
<InputPassword @bind-Value="@context.PasswordConfirmation" />
|
|
|
|
|
</FormItem>
|
|
|
|
|
<FormItem>
|
|
|
|
|
<Button Type="ButtonType.Primary" HtmlType="submit">
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
@LocalizationService.GetString("Register")
|
2025-01-05 21:09:57 -06:00
|
|
|
</Button>
|
|
|
|
|
</FormItem>
|
|
|
|
|
</Form>
|
|
|
|
|
|
|
|
|
|
@code {
|
2025-09-24 20:58:23 -05:00
|
|
|
[Parameter] public Uri ServerAddress { get; set; }
|
2025-01-20 12:10:30 -06:00
|
|
|
[Parameter] public EventCallback OnBack { get; set; }
|
2025-06-22 00:00:58 +02:00
|
|
|
[Parameter] public IEnumerable<string> Errors { get; set; } = [];
|
2025-01-05 21:09:57 -06:00
|
|
|
|
|
|
|
|
RegistrationRequest Model = new();
|
|
|
|
|
bool Loading = false;
|
2025-09-24 20:58:23 -05:00
|
|
|
private Uri? PreviousServerAddress;
|
2025-06-22 00:00:58 +02:00
|
|
|
|
2025-01-05 21:09:57 -06:00
|
|
|
protected override async Task OnParametersSetAsync()
|
|
|
|
|
{
|
2025-06-11 21:48:01 +02:00
|
|
|
if (ServerAddress != PreviousServerAddress)
|
2025-12-31 20:01:04 -06:00
|
|
|
await ConnectionClient.UpdateServerAddressAsync(ServerAddress.ToString());
|
2025-08-03 00:55:27 -05:00
|
|
|
|
2025-06-11 21:48:01 +02:00
|
|
|
PreviousServerAddress = ServerAddress;
|
2025-06-22 00:00:58 +02:00
|
|
|
|
2025-08-03 00:55:27 -05:00
|
|
|
ClearErrors();
|
|
|
|
|
|
2025-01-05 21:09:57 -06:00
|
|
|
}
|
2025-08-03 00:55:27 -05:00
|
|
|
|
2025-06-22 00:00:58 +02:00
|
|
|
protected void ClearErrors()
|
|
|
|
|
{
|
2025-08-03 00:55:27 -05:00
|
|
|
Errors = [];
|
|
|
|
|
StateHasChanged();
|
|
|
|
|
}
|
2025-01-05 21:09:57 -06:00
|
|
|
|
|
|
|
|
async Task OnFinish(EditContext editContext)
|
|
|
|
|
{
|
|
|
|
|
Loading = true;
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
2025-06-22 00:00:58 +02:00
|
|
|
ClearErrors();
|
|
|
|
|
|
2025-09-24 20:58:23 -05:00
|
|
|
await AuthenticationService.Register(Model.UserName, Model.Password, Model.PasswordConfirmation);
|
2025-01-05 21:09:57 -06:00
|
|
|
|
2025-02-06 20:54:03 -06:00
|
|
|
await ImportManagerService.RequestImport();
|
2025-01-05 21:09:57 -06:00
|
|
|
|
|
|
|
|
NavigationManager.NavigateTo("/");
|
|
|
|
|
}
|
2025-06-22 00:00:58 +02:00
|
|
|
catch (RegisterFailedException ex)
|
|
|
|
|
{
|
|
|
|
|
Errors = ex.ErrorData.Details?.Select(x => x.Message) ?? [];
|
|
|
|
|
MessageService.Error(ex.Message, 5);
|
|
|
|
|
}
|
2025-01-05 21:09:57 -06:00
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
MessageService.Error(ex.Message, 5);
|
|
|
|
|
Logger.LogError(ex, ex.Message);
|
2025-06-22 00:00:58 +02:00
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
2025-01-05 21:09:57 -06:00
|
|
|
Loading = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|