mirror of
https://github.com/openziti/desktop-edge-win.git
synced 2026-10-23 12:46:00 +00:00
Merge pull request #484 from openziti/ZET-UI-integration
Zet UI integration
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -274,9 +274,9 @@ namespace ZitiDesktopEdge.ServiceClient {
|
||||
return null;
|
||||
}
|
||||
|
||||
async public Task<MfaRecoveryCodesResponse> ReturnMFACodes(string identifier, string totpOrRecoveryCode) {
|
||||
async public Task<MfaRecoveryCodesResponse> GetMFACodes(string identifier, string totpOrRecoveryCode) {
|
||||
try {
|
||||
await sendAsync(new ReturnMFACodesFunction(identifier, totpOrRecoveryCode));
|
||||
await sendAsync(new GetMFACodesFunction(identifier, totpOrRecoveryCode));
|
||||
MfaRecoveryCodesResponse mfa = await readAsync<MfaRecoveryCodesResponse>(ipcReader);
|
||||
return mfa;
|
||||
} catch (Exception ioe) {
|
||||
|
||||
Reference in New Issue
Block a user