diff --git a/DesktopEdge/Views/Screens/Debugging.xaml.cs b/DesktopEdge/Views/Screens/Debugging.xaml.cs index ea1c4c6a..0e43a8b7 100644 --- a/DesktopEdge/Views/Screens/Debugging.xaml.cs +++ b/DesktopEdge/Views/Screens/Debugging.xaml.cs @@ -70,7 +70,7 @@ namespace Ziti.Desktop.Edge.Views.Screens { } async private void btn5_Click(object sender, RoutedEventArgs e) { - await client.ReturnMFACodes(FingerPrint.Text, TheMFACode.Text); + await client.GetMFACodes(FingerPrint.Text, TheMFACode.Text); } async private void btn6_Click(object sender, RoutedEventArgs e) { diff --git a/DesktopEdge/Views/Screens/MFAScreen.xaml.cs b/DesktopEdge/Views/Screens/MFAScreen.xaml.cs index a40b9c34..ec3a029b 100644 --- a/DesktopEdge/Views/Screens/MFAScreen.xaml.cs +++ b/DesktopEdge/Views/Screens/MFAScreen.xaml.cs @@ -178,11 +178,11 @@ namespace ZitiDesktopEdge { } } - async private void ReturnMFACodes(object sender, MouseButtonEventArgs e) { + async private void GetMFACodes(object sender, MouseButtonEventArgs e) { DataClient serviceClient = serviceClient = (DataClient)Application.Current.Properties["ServiceClient"]; string code = AuthCode.Text; Logger.Debug("AuthMFA successful."); - MfaRecoveryCodesResponse getcodes = await serviceClient.ReturnMFACodes(this._identity.Identifier, code); + MfaRecoveryCodesResponse getcodes = await serviceClient.GetMFACodes(this._identity.Identifier, code); if (getcodes.Code != 0) { Logger.Error("AuthMFA failed. " + getcodes.Error); } @@ -256,14 +256,14 @@ namespace ZitiDesktopEdge { } this.OnLoad?.Invoke(true, "", ""); } else if (this.Type == 2) { - MfaRecoveryCodesResponse codeResponse = await serviceClient.ReturnMFACodes(this._identity.Identifier, code); + MfaRecoveryCodesResponse codeResponse = await serviceClient.GetMFACodes(this._identity.Identifier, code); if (codeResponse?.Code != 0) { Logger.Error("AuthMFA failed. " + codeResponse.Error); AuthCode.Text = ""; this.OnError?.Invoke("Authentication Failed"); this._executing = false; } else { - this._identity.RecoveryCodes = codeResponse.Data; + this._identity.RecoveryCodes = codeResponse.Data.RecoveryCodes; this.OnClose?.Invoke(true); this._executing = false; } @@ -287,7 +287,7 @@ namespace ZitiDesktopEdge { AuthCode.Text = ""; this.OnError?.Invoke("Authentication Failed"); } else { - this._identity.RecoveryCodes = codeResponse.Data; + this._identity.RecoveryCodes = codeResponse.Data.RecoveryCodes; this.OnClose?.Invoke(true); } this._executing = false; diff --git a/ZitiDesktopEdge.Client/DataStructures/DataStructures.cs b/ZitiDesktopEdge.Client/DataStructures/DataStructures.cs index fc1c7d6c..b7fd15a0 100644 --- a/ZitiDesktopEdge.Client/DataStructures/DataStructures.cs +++ b/ZitiDesktopEdge.Client/DataStructures/DataStructures.cs @@ -159,17 +159,17 @@ namespace ZitiDesktopEdge.DataStructures { public string Code { get; set; } } - public class ReturnMFACodesFunction : ServiceFunction { - public ReturnMFACodesFunction(string identifier, string code) { - this.Command = "ReturnMFACodes"; - this.Data = new ReturnMFACodesFunctionPayload() { + public class GetMFACodesFunction : ServiceFunction { + public GetMFACodesFunction(string identifier, string code) { + this.Command = "GetMFACodes"; + this.Data = new GetMFACodesFunctionPayload() { Identifier = identifier, Code = code, }; } - public ReturnMFACodesFunctionPayload Data { get; set; } + public GetMFACodesFunctionPayload Data { get; set; } } - public class ReturnMFACodesFunctionPayload { + public class GetMFACodesFunctionPayload { public string Identifier { get; set; } public string Code { get; set; } } @@ -506,9 +506,14 @@ namespace ZitiDesktopEdge.DataStructures { public string Identifier { get; set; } } + public class MfaRecoveryCodes { + public string[] RecoveryCodes { get; set; } + public string Identifier { get; set; } + + } public class MfaRecoveryCodesResponse : SvcResponse { - public string[] Data { get; set; } + public MfaRecoveryCodes Data { get; set; } } public class ConfigPayload diff --git a/ZitiDesktopEdge.Client/ServiceClient/DataClient.cs b/ZitiDesktopEdge.Client/ServiceClient/DataClient.cs index 77ec0d5a..9e279b6f 100644 --- a/ZitiDesktopEdge.Client/ServiceClient/DataClient.cs +++ b/ZitiDesktopEdge.Client/ServiceClient/DataClient.cs @@ -274,9 +274,9 @@ namespace ZitiDesktopEdge.ServiceClient { return null; } - async public Task ReturnMFACodes(string identifier, string totpOrRecoveryCode) { + async public Task GetMFACodes(string identifier, string totpOrRecoveryCode) { try { - await sendAsync(new ReturnMFACodesFunction(identifier, totpOrRecoveryCode)); + await sendAsync(new GetMFACodesFunction(identifier, totpOrRecoveryCode)); MfaRecoveryCodesResponse mfa = await readAsync(ipcReader); return mfa; } catch (Exception ioe) {