Sign in , out ,register.
This commit is contained in:
@@ -27,11 +27,15 @@ namespace Wino.Services;
|
||||
|
||||
public class DialogService : DialogServiceBase, IMailDialogService
|
||||
{
|
||||
private readonly IWinoAccountProfileService _winoAccountProfileService;
|
||||
|
||||
public DialogService(INewThemeService themeService,
|
||||
IConfigurationService configurationService,
|
||||
IApplicationResourceManager<ResourceDictionary> applicationResourceManager,
|
||||
IUpdateManager updateManager) : base(themeService, configurationService, applicationResourceManager, updateManager)
|
||||
IUpdateManager updateManager,
|
||||
IWinoAccountProfileService winoAccountProfileService) : base(themeService, configurationService, applicationResourceManager, updateManager)
|
||||
{
|
||||
_winoAccountProfileService = winoAccountProfileService;
|
||||
}
|
||||
|
||||
public async Task<ICreateAccountAliasDialog> ShowCreateAccountAliasDialogAsync()
|
||||
@@ -213,4 +217,32 @@ public class DialogService : DialogServiceBase, IMailDialogService
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public async Task<WinoAccount?> ShowWinoAccountRegistrationDialogAsync()
|
||||
{
|
||||
var dialog = new WinoAccountRegistrationDialog(_winoAccountProfileService)
|
||||
{
|
||||
RequestedTheme = ThemeService.RootTheme.ToWindowsElementTheme()
|
||||
};
|
||||
|
||||
var result = await HandleDialogPresentationAsync(dialog);
|
||||
|
||||
return result == ContentDialogResult.Primary
|
||||
? dialog.Result
|
||||
: null;
|
||||
}
|
||||
|
||||
public async Task<WinoAccount?> ShowWinoAccountLoginDialogAsync()
|
||||
{
|
||||
var dialog = new WinoAccountLoginDialog(_winoAccountProfileService)
|
||||
{
|
||||
RequestedTheme = ThemeService.RootTheme.ToWindowsElementTheme()
|
||||
};
|
||||
|
||||
var result = await HandleDialogPresentationAsync(dialog);
|
||||
|
||||
return result == ContentDialogResult.Primary
|
||||
? dialog.Result
|
||||
: null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
using Wino.Core.Domain;
|
||||
using Wino.Mail.Api.Contracts.Common;
|
||||
|
||||
namespace Wino.Mail.WinUI.Services;
|
||||
|
||||
public static class WinoAccountAuthErrorTranslator
|
||||
{
|
||||
public static string Translate(string? errorCode)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(errorCode))
|
||||
{
|
||||
return Translator.GeneralTitle_Error;
|
||||
}
|
||||
|
||||
return errorCode switch
|
||||
{
|
||||
ApiErrorCodes.InvalidCredentials => Translator.WinoAccount_Error_InvalidCredentials,
|
||||
ApiErrorCodes.AccountLocked => Translator.WinoAccount_Error_AccountLocked,
|
||||
ApiErrorCodes.AccountBanned => Translator.WinoAccount_Error_AccountBanned,
|
||||
ApiErrorCodes.AccountSuspended => Translator.WinoAccount_Error_AccountSuspended,
|
||||
ApiErrorCodes.RefreshTokenInvalid => Translator.WinoAccount_Error_RefreshTokenInvalid,
|
||||
ApiErrorCodes.EmailAlreadyRegistered => Translator.WinoAccount_Error_EmailAlreadyRegistered,
|
||||
ApiErrorCodes.ExternalLoginEmailRequired => Translator.WinoAccount_Error_ExternalLoginEmailRequired,
|
||||
ApiErrorCodes.ExternalLoginInvalid => Translator.WinoAccount_Error_ExternalLoginInvalid,
|
||||
ApiErrorCodes.ExternalAuthStateInvalid => Translator.WinoAccount_Error_ExternalAuthStateInvalid,
|
||||
ApiErrorCodes.ExternalAuthCodeInvalid => Translator.WinoAccount_Error_ExternalAuthCodeInvalid,
|
||||
ApiErrorCodes.Forbidden => Translator.WinoAccount_Error_Forbidden,
|
||||
ApiErrorCodes.ValidationFailed => Translator.WinoAccount_Error_ValidationFailed,
|
||||
_ => errorCode
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user