complete cancel registration

This commit is contained in:
Lightczx
2023-11-02 10:42:55 +08:00
parent c6435f30eb
commit df019da891
3 changed files with 8 additions and 7 deletions

View File

@@ -26,12 +26,12 @@ internal sealed partial class HutaoPassportUnregisterDialog : ContentDialog
infoBarService = serviceProvider.GetRequiredService<IInfoBarService>();
}
public async ValueTask<ValueResult<bool, (string UserName, string Passport)>> GetInputAsync()
public async ValueTask<ValueResult<bool, (string UserName, string Passport, string VerifyCode)>> GetInputAsync()
{
await taskContext.SwitchToMainThreadAsync();
ContentDialogResult result = await ShowAsync();
return new(result is ContentDialogResult.Primary, (UserName, Password));
return new(result is ContentDialogResult.Primary, (UserName, Password, VerifyCode));
}
[Command("VerifyCommand")]

View File

@@ -67,18 +67,18 @@ internal sealed partial class HutaoPassportViewModel : Abstraction.ViewModel
private async Task UnregisterAsync()
{
HutaoPassportUnregisterDialog dialog = await contentDialogFactory.CreateInstanceAsync<HutaoPassportUnregisterDialog>().ConfigureAwait(false);
ValueResult<bool, (string UserName, string Password)> result = await dialog.GetInputAsync().ConfigureAwait(false);
ValueResult<bool, (string UserName, string Password, string VerifyCode)> result = await dialog.GetInputAsync().ConfigureAwait(false);
if (result.IsOk)
{
(string username, string password) = result.Value;
(string username, string password, string verifyCode) = result.Value;
if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password))
if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(verifyCode))
{
return;
}
HutaoResponse response = await homaPassportClient.UnregisterAsync(username, password).ConfigureAwait(false);
HutaoResponse response = await homaPassportClient.UnregisterAsync(username, password, verifyCode).ConfigureAwait(false);
if (response.IsOk())
{

View File

@@ -96,12 +96,13 @@ internal sealed partial class HomaPassportClient
return HutaoResponse.DefaultIfNull(resp);
}
public async ValueTask<HutaoResponse> UnregisterAsync(string email, string password, CancellationToken token = default)
public async ValueTask<HutaoResponse> UnregisterAsync(string email, string password, string verifyCode, CancellationToken token = default)
{
Dictionary<string, string> data = new()
{
["UserName"] = Encrypt(email),
["Password"] = Encrypt(password),
["VerifyCode"] = Encrypt(verifyCode),
};
HttpRequestMessageBuilder builder = httpRequestMessageBuilderFactory.Create()