2025-01-05 21:09:57 -06:00
|
|
|
@using LANCommander.SDK.Models
|
|
|
|
|
@using Newtonsoft.Json
|
|
|
|
|
@using Photino.NET
|
|
|
|
|
@inject SDK.Client Client
|
|
|
|
|
@inject IJSRuntime JSRuntime
|
|
|
|
|
@inject IMessageService MessageService
|
|
|
|
|
@inject ILogger<AuthenticationProviderDialog> Logger
|
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
|
|
|
|
|
|
|
|
@code {
|
|
|
|
|
[Parameter] public EventCallback<AuthToken> OnTokenReceived { get; set; }
|
|
|
|
|
|
|
|
|
|
string AuthenticationProviderLoginUrl;
|
|
|
|
|
|
|
|
|
|
PhotinoWindow Window;
|
|
|
|
|
|
|
|
|
|
public async Task Open(string baseUrl, AuthenticationProvider authenticationProvider)
|
|
|
|
|
{
|
2025-03-11 01:11:20 -05:00
|
|
|
await Client.ChangeServerAddressAsync(baseUrl);
|
2025-01-05 21:09:57 -06:00
|
|
|
|
|
|
|
|
AuthenticationProviderLoginUrl = Client.GetAuthenticationProviderLoginUrl(authenticationProvider.Slug);
|
|
|
|
|
|
|
|
|
|
Window = new PhotinoWindow()
|
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
|
|
|
.SetTitle(LocalizationService.GetString("SignInUsingProvider", authenticationProvider.Name))
|
2025-01-05 21:09:57 -06:00
|
|
|
.Load(AuthenticationProviderLoginUrl)
|
|
|
|
|
.SetContextMenuEnabled(false);
|
|
|
|
|
|
|
|
|
|
Window.RegisterWebMessageReceivedHandler(MessageHandler);
|
|
|
|
|
|
|
|
|
|
Window.WaitForClose();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async void MessageHandler(object? sender, string message)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var token = JsonConvert.DeserializeObject<AuthToken>(message);
|
|
|
|
|
|
|
|
|
|
await InvokeAsync(() =>
|
|
|
|
|
{
|
|
|
|
|
OnTokenReceived.InvokeAsync(token);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
Logger.LogError(ex, "Could not process login");
|
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
|
|
|
MessageService.Error(LocalizationService.GetString("CouldNotProcessLogin"));
|
2025-01-05 21:09:57 -06:00
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
Window.Close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|