mirror of
https://github.com/openziti/desktop-edge-win.git
synced 2026-10-14 00:29:48 +00:00
UI Cleanup
This commit is contained in:
@@ -123,6 +123,7 @@ namespace ZitiDesktopEdge {
|
||||
ShowBlurb("Unexpected error when processing MFA", "");
|
||||
logger.Error("unexpected action: " + mfa.Action);
|
||||
}
|
||||
LoadIdentities(true);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -276,7 +277,6 @@ namespace ZitiDesktopEdge {
|
||||
logger.Info("========================================================================");
|
||||
|
||||
App.Current.MainWindow.WindowState = WindowState.Normal;
|
||||
App.Current.MainWindow.Closing += MainWindow_Closing;
|
||||
App.Current.MainWindow.Deactivated += MainWindow_Deactivated;
|
||||
App.Current.MainWindow.Activated += MainWindow_Activated;
|
||||
|
||||
@@ -864,6 +864,7 @@ namespace ZitiDesktopEdge {
|
||||
} else {
|
||||
idItem.ToggleStatus.Content = "DISABLED";
|
||||
}
|
||||
idItem.Authenticate += IdItem_Authenticate;
|
||||
idItem.OnStatusChanged += Id_OnStatusChanged;
|
||||
idItem.Identity = id;
|
||||
IdList.Children.Add(idItem);
|
||||
@@ -884,6 +885,10 @@ namespace ZitiDesktopEdge {
|
||||
});
|
||||
}
|
||||
|
||||
private void IdItem_Authenticate(ZitiIdentity identity) {
|
||||
ShowAuthenticate(identity);
|
||||
}
|
||||
|
||||
private void Id_OnStatusChanged(bool attached) {
|
||||
for (int i = 0; i < IdList.Children.Count; i++) {
|
||||
IdentityItem item = IdList.Children[i] as IdentityItem;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
d:DesignHeight="64" d:DesignWidth="375" Height="64">
|
||||
<Canvas Name="MainArea" MouseEnter="Canvas_MouseEnter" MouseLeave="Canvas_MouseLeave">
|
||||
<Rectangle Fill="#0F0C28" HorizontalAlignment="Left" Stroke="Black" VerticalAlignment="Top" ClipToBounds="True"></Rectangle>
|
||||
<Rectangle Name="OverState" Fill="#FFFFFF" Height="64" Width="400" Opacity="0" ClipToBounds="True" Cursor="Hand"></Rectangle>
|
||||
<Rectangle Name="OverState" Fill="#FFFFFF" Height="64" Width="400" Opacity="0" ClipToBounds="True"></Rectangle>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
@@ -25,7 +25,7 @@
|
||||
<RowDefinition Height="20"/>
|
||||
</Grid.RowDefinitions>
|
||||
<local:Toggler x:Name="ToggleSwitch" Grid.Column="0" Grid.Row="0" Margin="0,10,0,0"></local:Toggler>
|
||||
<Label Name="ToggleStatus" Cursor="Hand" Grid.Column="0" Grid.Row="1" Margin="0,-5,0,0" Content="Enabled" Foreground="White" FontSize="11" Typography.Capitals="AllSmallCaps" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center"></Label>
|
||||
<Label Name="ToggleStatus" Grid.Column="0" Grid.Row="1" Margin="0,-5,0,0" Content="Enabled" Foreground="White" FontSize="11" Typography.Capitals="AllSmallCaps" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center"></Label>
|
||||
<Label Name="IdName" Cursor="Hand" MouseUp="OpenDetails" MaxWidth="230" VerticalAlignment="Bottom" Grid.Column="1" Margin="0,6,0,0" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" FontSize="16" Foreground="White" HorizontalAlignment="Left">
|
||||
<TextBlock TextTrimming="CharacterEllipsis">Identity Name</TextBlock>
|
||||
</Label>
|
||||
|
||||
@@ -40,18 +40,17 @@ namespace ZitiDesktopEdge {
|
||||
public void RefreshUI () {
|
||||
ToggleSwitch.Enabled = _identity.IsEnabled;
|
||||
if (_identity.IsMFAEnabled) {
|
||||
// Clint I need a sign
|
||||
// if (_identity.IsMFAAuthentcated) {
|
||||
ServiceCountArea.Visibility = Visibility.Visible;
|
||||
MfaRequired.Visibility = Visibility.Collapsed;
|
||||
ServiceCountAreaLabel.Content = "services";
|
||||
MainArea.Opacity = 1.0;
|
||||
// } else {
|
||||
ServiceCountArea.Visibility = Visibility.Collapsed;
|
||||
MfaRequired.Visibility = Visibility.Visible;
|
||||
ServiceCountAreaLabel.Content = "authorize";
|
||||
MainArea.Opacity = 0.6;
|
||||
// }
|
||||
if (_identity.MFAInfo.IsAuthenticated) {
|
||||
ServiceCountArea.Visibility = Visibility.Visible;
|
||||
MfaRequired.Visibility = Visibility.Collapsed;
|
||||
ServiceCountAreaLabel.Content = "services";
|
||||
MainArea.Opacity = 1.0;
|
||||
} else {
|
||||
ServiceCountArea.Visibility = Visibility.Collapsed;
|
||||
MfaRequired.Visibility = Visibility.Visible;
|
||||
ServiceCountAreaLabel.Content = "authorize";
|
||||
MainArea.Opacity = 0.6;
|
||||
}
|
||||
} else {
|
||||
ServiceCountArea.Visibility = Visibility.Visible;
|
||||
MfaRequired.Visibility = Visibility.Collapsed;
|
||||
|
||||
@@ -56,22 +56,6 @@ namespace ZitiDesktopEdge {
|
||||
UpdateView();
|
||||
IdentityArea.Opacity = 1.0;
|
||||
IdentityArea.Visibility = Visibility.Visible;
|
||||
IdentityMFA.IsOn = _identity.IsMFAEnabled;
|
||||
if (_identity.IsMFAEnabled) {
|
||||
if (_identity.MFAInfo.IsAuthenticated) {
|
||||
IdentityMFA.AuthOn.Visibility = Visibility.Visible;
|
||||
IdentityMFA.AuthOff.Visibility = Visibility.Collapsed;
|
||||
IdentityMFA.RecoveryButton.Visibility = Visibility.Visible;
|
||||
} else {
|
||||
IdentityMFA.AuthOn.Visibility = Visibility.Collapsed;
|
||||
IdentityMFA.AuthOff.Visibility = Visibility.Visible;
|
||||
IdentityMFA.RecoveryButton.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
} else {
|
||||
IdentityMFA.AuthOn.Visibility = Visibility.Collapsed;
|
||||
IdentityMFA.AuthOff.Visibility = Visibility.Collapsed;
|
||||
IdentityMFA.RecoveryButton.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
this.Visibility = Visibility.Visible;
|
||||
}
|
||||
}
|
||||
@@ -104,11 +88,6 @@ namespace ZitiDesktopEdge {
|
||||
}
|
||||
|
||||
public void UpdateView() {
|
||||
if(_identity.IsMFAEnabled && !_identity.MFAInfo.IsAuthenticated) {
|
||||
//verify mfa here
|
||||
MainWindow.MFAAuthenticate(_identity);
|
||||
}
|
||||
|
||||
IdDetailName.Text = _identity.Name;
|
||||
IdDetailName.ToolTip = _identity.Name;
|
||||
IdDetailToggle.Enabled = _identity.IsEnabled;
|
||||
@@ -117,12 +96,16 @@ namespace ZitiDesktopEdge {
|
||||
IdentityEnrollment.Value = _identity.EnrollmentStatus;
|
||||
IdentityStatus.Value = _identity.IsEnabled ? "active" : "disabled";
|
||||
IdentityMFA.IsOn = _identity.IsMFAEnabled;
|
||||
IdentityMFA.ToggleField.Opacity = 1;
|
||||
if (_identity.IsMFAEnabled) {
|
||||
if (_identity.MFAInfo.IsAuthenticated) {
|
||||
IdentityMFA.ToggleField.IsEnabled = true;
|
||||
IdentityMFA.AuthOn.Visibility = Visibility.Visible;
|
||||
IdentityMFA.AuthOff.Visibility = Visibility.Collapsed;
|
||||
IdentityMFA.RecoveryButton.Visibility = Visibility.Visible;
|
||||
} else {
|
||||
IdentityMFA.ToggleField.Opacity = 0.2;
|
||||
IdentityMFA.ToggleField.IsEnabled = false;
|
||||
IdentityMFA.AuthOn.Visibility = Visibility.Collapsed;
|
||||
IdentityMFA.AuthOff.Visibility = Visibility.Visible;
|
||||
IdentityMFA.RecoveryButton.Visibility = Visibility.Collapsed;
|
||||
|
||||
@@ -50,63 +50,13 @@
|
||||
</StackPanel>
|
||||
<Label Content="enter the code below to finish setup" Grid.Row="4" FontSize="11" Foreground="DarkGray" HorizontalAlignment="Center"></Label>
|
||||
<Label Content="Authentication Code" Grid.Row="5" FontSize="18" Foreground="#FFFFFF" HorizontalAlignment="Center" FontWeight="Bold" FontFamily="/ZitiDesktopEdge;component/Assets/Fonts/#Russo One"></Label>
|
||||
<Grid Grid.Row="6" HorizontalAlignment="Center">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="50"></ColumnDefinition>
|
||||
<ColumnDefinition Width="2"></ColumnDefinition>
|
||||
<ColumnDefinition Width="50"></ColumnDefinition>
|
||||
<ColumnDefinition Width="2"></ColumnDefinition>
|
||||
<ColumnDefinition Width="50"></ColumnDefinition>
|
||||
<ColumnDefinition Width="2"></ColumnDefinition>
|
||||
<ColumnDefinition Width="50"></ColumnDefinition>
|
||||
<ColumnDefinition Width="2"></ColumnDefinition>
|
||||
<ColumnDefinition Width="50"></ColumnDefinition>
|
||||
<ColumnDefinition Width="2"></ColumnDefinition>
|
||||
<ColumnDefinition Width="50"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBox x:Name="SetupAuth1" MaxLength="1" Padding="0,5,0,0" TextBlock.LineHeight="80" Grid.Column="0" KeyUp="GoNextSetup" BorderThickness="0 0 0 0" TextAlignment="Center" FontSize="50">
|
||||
<TextBox.Resources>
|
||||
<Style TargetType="{x:Type Border}">
|
||||
<Setter Property="CornerRadius" Value="7"/>
|
||||
</Style>
|
||||
</TextBox.Resources>
|
||||
</TextBox>
|
||||
<TextBox x:Name="SetupAuth2" MaxLength="1" Padding="0,5,0,0" TextBlock.LineHeight="80" Grid.Column="2" KeyUp="GoNextSetup" BorderThickness="0 0 0 0" TextAlignment="Center" FontSize="50">
|
||||
<TextBox.Resources>
|
||||
<Style TargetType="{x:Type Border}">
|
||||
<Setter Property="CornerRadius" Value="7"/>
|
||||
</Style>
|
||||
</TextBox.Resources>
|
||||
</TextBox>
|
||||
<TextBox x:Name="SetupAuth3" MaxLength="1" Padding="0,5,0,0" TextBlock.LineHeight="80" Grid.Column="4" KeyUp="GoNextSetup" BorderThickness="0 0 0 0" TextAlignment="Center" FontSize="50">
|
||||
<TextBox.Resources>
|
||||
<Style TargetType="{x:Type Border}">
|
||||
<Setter Property="CornerRadius" Value="7"/>
|
||||
</Style>
|
||||
</TextBox.Resources>
|
||||
</TextBox>
|
||||
<TextBox x:Name="SetupAuth4" MaxLength="1" Padding="0,5,0,0" TextBlock.LineHeight="80" Grid.Column="6" KeyUp="GoNextSetup" BorderThickness="0 0 0 0" TextAlignment="Center" FontSize="50">
|
||||
<TextBox.Resources>
|
||||
<Style TargetType="{x:Type Border}">
|
||||
<Setter Property="CornerRadius" Value="7"/>
|
||||
</Style>
|
||||
</TextBox.Resources>
|
||||
</TextBox>
|
||||
<TextBox x:Name="SetupAuth5" MaxLength="1" Padding="0,5,0,0" TextBlock.LineHeight="80" Grid.Column="8" KeyUp="GoNextSetup" BorderThickness="0 0 0 0" TextAlignment="Center" FontSize="50">
|
||||
<TextBox.Resources>
|
||||
<Style TargetType="{x:Type Border}">
|
||||
<Setter Property="CornerRadius" Value="7"/>
|
||||
</Style>
|
||||
</TextBox.Resources>
|
||||
</TextBox>
|
||||
<TextBox x:Name="SetupAuth6" MaxLength="1" Padding="0,5,0,0" TextBlock.LineHeight="80" Grid.Column="10" BorderThickness="0 0 0 0" TextAlignment="Center" FontSize="50">
|
||||
<TextBox.Resources>
|
||||
<Style TargetType="{x:Type Border}">
|
||||
<Setter Property="CornerRadius" Value="7"/>
|
||||
</Style>
|
||||
</TextBox.Resources>
|
||||
</TextBox>
|
||||
</Grid>
|
||||
<TextBox x:Name="SetupCode" MaxLength="6" Padding="0,5,0,0" TextBlock.LineHeight="80" Grid.Row="6" Keyboard.KeyUp="HandleKey" BorderThickness="0 0 0 0" TextAlignment="Center" FontSize="50">
|
||||
<TextBox.Resources>
|
||||
<Style TargetType="{x:Type Border}">
|
||||
<Setter Property="CornerRadius" Value="7"/>
|
||||
</Style>
|
||||
</TextBox.Resources>
|
||||
</TextBox>
|
||||
<Rectangle x:Name="AuthSetupBg" Margin="40,0,40,0" Opacity="0.8" RadiusX="7" Grid.Row="8" RadiusY="7" ClipToBounds="True" Height="30" VerticalAlignment="Bottom" MouseUp="DoSetupAuthenticate" Cursor="Hand" MouseEnter="HoverAuthSetup" MouseLeave="LeaveAuthSetup" MouseDown="AuthSetupClicked">
|
||||
<Rectangle.Fill>
|
||||
<SolidColorBrush x:Name="AuthBgColor" Color="#0069FF"/>
|
||||
@@ -151,60 +101,13 @@
|
||||
</Grid.RowDefinitions>
|
||||
<Label Content="Authorize MFA" Grid.Row="0" FontSize="16" HorizontalAlignment="Center" FontWeight="Bold"></Label>
|
||||
<Label x:Name="AuthSubTitle" Content="Enter your authentication code" Grid.Row="1" FontSize="12" HorizontalAlignment="Center"></Label>
|
||||
<Grid x:Name="AuthCodeArea" Grid.Row="2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="50"></ColumnDefinition>
|
||||
<ColumnDefinition Width="2"></ColumnDefinition>
|
||||
<ColumnDefinition Width="50"></ColumnDefinition>
|
||||
<ColumnDefinition Width="2"></ColumnDefinition>
|
||||
<ColumnDefinition Width="50"></ColumnDefinition>
|
||||
<ColumnDefinition Width="2"></ColumnDefinition>
|
||||
<ColumnDefinition Width="50"></ColumnDefinition>
|
||||
<ColumnDefinition Width="2"></ColumnDefinition>
|
||||
<ColumnDefinition Width="50"></ColumnDefinition>
|
||||
<ColumnDefinition Width="2"></ColumnDefinition>
|
||||
<ColumnDefinition Width="50"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBox x:Name="Auth1" MaxLength="1" Grid.Column="0" KeyUp="GoNext" BorderThickness="0 0 0 2" TextAlignment="Center" FontSize="50"></TextBox>
|
||||
<TextBox x:Name="Auth2" MaxLength="1" Grid.Column="2" KeyUp="GoNext" BorderThickness="0 0 0 2" TextAlignment="Center" FontSize="50"></TextBox>
|
||||
<TextBox x:Name="Auth3" MaxLength="1" Grid.Column="4" KeyUp="GoNext" BorderThickness="0 0 0 2" TextAlignment="Center" FontSize="50"></TextBox>
|
||||
<TextBox x:Name="Auth4" MaxLength="1" Grid.Column="6" KeyUp="GoNext" BorderThickness="0 0 0 2" TextAlignment="Center" FontSize="50"></TextBox>
|
||||
<TextBox x:Name="Auth5" MaxLength="1" Grid.Column="8" KeyUp="GoNext" BorderThickness="0 0 0 2" TextAlignment="Center" FontSize="50"></TextBox>
|
||||
<TextBox x:Name="Auth6" MaxLength="1" Grid.Column="10" BorderThickness="0 0 0 2" TextAlignment="Center" FontSize="50"></TextBox>
|
||||
</Grid>
|
||||
<Grid x:Name="AuthRecoveryArea" Visibility="Collapsed" Grid.Row="2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="40"></ColumnDefinition>
|
||||
<ColumnDefinition Width="2"></ColumnDefinition>
|
||||
<ColumnDefinition Width="40"></ColumnDefinition>
|
||||
<ColumnDefinition Width="2"></ColumnDefinition>
|
||||
<ColumnDefinition Width="40"></ColumnDefinition>
|
||||
<ColumnDefinition Width="2"></ColumnDefinition>
|
||||
<ColumnDefinition Width="40"></ColumnDefinition>
|
||||
<ColumnDefinition Width="2"></ColumnDefinition>
|
||||
<ColumnDefinition Width="40"></ColumnDefinition>
|
||||
<ColumnDefinition Width="2"></ColumnDefinition>
|
||||
<ColumnDefinition Width="40"></ColumnDefinition>
|
||||
<ColumnDefinition Width="2"></ColumnDefinition>
|
||||
<ColumnDefinition Width="40"></ColumnDefinition>
|
||||
<ColumnDefinition Width="2"></ColumnDefinition>
|
||||
<ColumnDefinition Width="40"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBox x:Name="Rec1" MaxLength="1" Grid.Column="0" KeyUp="GoNextRecovery" BorderThickness="0 0 0 2" TextAlignment="Center" FontSize="50">
|
||||
<TextBox.Resources>
|
||||
<Style TargetType="{x:Type Border}">
|
||||
<Setter Property="CornerRadius" Value="7"/>
|
||||
</Style>
|
||||
</TextBox.Resources>
|
||||
</TextBox>
|
||||
<TextBox x:Name="Rec2" MaxLength="1" Grid.Column="2" KeyUp="GoNextRecovery" BorderThickness="0 0 0 2" TextAlignment="Center" FontSize="50"></TextBox>
|
||||
<TextBox x:Name="Rec3" MaxLength="1" Grid.Column="4" KeyUp="GoNextRecovery" BorderThickness="0 0 0 2" TextAlignment="Center" FontSize="50"></TextBox>
|
||||
<TextBox x:Name="Rec4" MaxLength="1" Grid.Column="6" KeyUp="GoNextRecovery" BorderThickness="0 0 0 2" TextAlignment="Center" FontSize="50"></TextBox>
|
||||
<TextBox x:Name="Rec5" MaxLength="1" Grid.Column="8" KeyUp="GoNextRecovery" BorderThickness="0 0 0 2" TextAlignment="Center" FontSize="50"></TextBox>
|
||||
<TextBox x:Name="Rec6" MaxLength="1" Grid.Column="10" KeyUp="GoNextRecovery" BorderThickness="0 0 0 2" TextAlignment="Center" FontSize="50"></TextBox>
|
||||
<TextBox x:Name="Rec7" MaxLength="1" Grid.Column="12" KeyUp="GoNextRecovery" BorderThickness="0 0 0 2" TextAlignment="Center" FontSize="50"></TextBox>
|
||||
<TextBox x:Name="Rec8" MaxLength="1" Grid.Column="14" BorderThickness="0 0 0 2" TextAlignment="Center" FontSize="50"></TextBox>
|
||||
</Grid>
|
||||
<TextBox x:Name="AuthCode" MaxLength="6" FontSize="50" Padding="0,5,0,0" Grid.Row="2" Keyboard.KeyUp="AuthCode_KeyUp" TextAlignment="Center" BorderThickness="0 0 0 2">
|
||||
<TextBox.Resources>
|
||||
<Style TargetType="{x:Type Border}">
|
||||
<Setter Property="CornerRadius" Value="7"/>
|
||||
</Style>
|
||||
</TextBox.Resources>
|
||||
</TextBox>
|
||||
<Grid Grid.Row="3">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="160"></ColumnDefinition>
|
||||
|
||||
@@ -67,6 +67,7 @@ namespace ZitiDesktopEdge {
|
||||
}
|
||||
|
||||
public void ShowSetup(ZitiIdentity identity, string url, string secret) {
|
||||
SetupCode.Text = "";
|
||||
this._identity = identity;
|
||||
MFAImage.Visibility = Visibility.Visible;
|
||||
SecretCode.Visibility = Visibility.Collapsed;
|
||||
@@ -84,7 +85,7 @@ namespace ZitiDesktopEdge {
|
||||
MFARecoveryArea.Visibility = Visibility.Collapsed;
|
||||
SeperationColor.Visibility = Visibility.Visible;
|
||||
for (int i = 1; i <= 6; i++) (this.FindName("SetupAuth" + i) as TextBox).Text = "";
|
||||
SetupAuth1.Focus();
|
||||
SetupCode.Focus();
|
||||
}
|
||||
|
||||
public void ShowRecovery(string[] codes, ZitiIdentity identity) {
|
||||
@@ -111,15 +112,14 @@ namespace ZitiDesktopEdge {
|
||||
}
|
||||
|
||||
public void ShowMFA(ZitiIdentity identity) {
|
||||
AuthCode.Text = "";
|
||||
this._identity = identity;
|
||||
MFASetupArea.Visibility = Visibility.Collapsed;
|
||||
MFARecoveryArea.Visibility = Visibility.Collapsed;
|
||||
SeperationColor.Visibility = Visibility.Collapsed;
|
||||
MFAAuthArea.Visibility = Visibility.Visible;
|
||||
MFAArea.Height = 220;
|
||||
for (int i = 1; i <= 6; i++) (this.FindName("Auth" + i) as TextBox).Text = "";
|
||||
for (int i = 1; i <= 8; i++) (this.FindName("Rec" + i) as TextBox).Text = "";
|
||||
Auth1.Focus();
|
||||
AuthCode.Focus();
|
||||
}
|
||||
|
||||
private BitmapImage LoadImage(string url) {
|
||||
@@ -136,77 +136,24 @@ namespace ZitiDesktopEdge {
|
||||
Process.Start(new ProcessStartInfo(_url) { UseShellExecute = true });
|
||||
}
|
||||
|
||||
private void GoNextSetup(object sender, KeyEventArgs e) {
|
||||
TextBox sentFrom = sender as TextBox;
|
||||
string name = sentFrom.Name;
|
||||
int index = 1;
|
||||
if (name == "SetupAuth1") index = 2;
|
||||
else if (name == "SetupAuth2") index = 3;
|
||||
else if (name == "SetupAuth3") index = 4;
|
||||
else if (name == "SetupAuth4") index = 5;
|
||||
else if (name == "SetupAuth5") index = 6;
|
||||
|
||||
TextBox entry = this.FindName("SetupAuth" + index) as TextBox;
|
||||
if (sentFrom.Text.Length > 0) {
|
||||
entry.Focus();
|
||||
entry.Select(0, entry.Text.Length);
|
||||
}
|
||||
}
|
||||
|
||||
private void GoNext(object sender, KeyEventArgs e) {
|
||||
TextBox sentFrom = sender as TextBox;
|
||||
string name = sentFrom.Name;
|
||||
int index = 1;
|
||||
if (name == "Auth1") index = 2;
|
||||
else if (name == "Auth2") index = 3;
|
||||
else if (name == "Auth3") index = 4;
|
||||
else if (name == "Auth4") index = 5;
|
||||
else if (name == "Auth5") index = 6;
|
||||
|
||||
TextBox entry = this.FindName("Auth"+index) as TextBox;
|
||||
if (sentFrom.Text.Length>0) {
|
||||
entry.Focus();
|
||||
}
|
||||
}
|
||||
|
||||
private void GoNextRecovery(object sender, KeyEventArgs e) {
|
||||
TextBox sentFrom = sender as TextBox;
|
||||
string name = sentFrom.Name;
|
||||
int index = 1;
|
||||
if (name == "Rec1") index = 2;
|
||||
else if (name == "Rec2") index = 3;
|
||||
else if (name == "Rec3") index = 4;
|
||||
else if (name == "Rec4") index = 5;
|
||||
else if (name == "Rec5") index = 6;
|
||||
else if (name == "Rec6") index = 7;
|
||||
else if (name == "Rec7") index = 8;
|
||||
|
||||
TextBox entry = this.FindName("Rec" + index) as TextBox;
|
||||
if (sentFrom.Text.Length > 0) {
|
||||
entry.Focus();
|
||||
}
|
||||
}
|
||||
|
||||
async private void ToggleRecovery(object sender, MouseButtonEventArgs e) {
|
||||
if (AuthRecoveryArea.Visibility==Visibility.Visible) {
|
||||
private void ToggleRecovery(object sender, MouseButtonEventArgs e) {
|
||||
AuthCode.Text = "";
|
||||
if (AuthCode.MaxLength==6) {
|
||||
GenerateMFACodes(null, null);
|
||||
AuthRecoveryArea.Visibility = Visibility.Collapsed;
|
||||
AuthCodeArea.Visibility = Visibility.Visible;
|
||||
ToggleType.Content = "Use Recovery Code";
|
||||
AuthSubTitle.Content = "Enter your authorization code";
|
||||
Auth1.Focus();
|
||||
} else {
|
||||
ReturnMFACodes(null, null);
|
||||
AuthRecoveryArea.Visibility = Visibility.Visible;
|
||||
AuthCodeArea.Visibility = Visibility.Collapsed;
|
||||
AuthCode.MaxLength = 8;
|
||||
ToggleType.Content = "Use Auth Code";
|
||||
AuthSubTitle.Content = "Enter a recovery code";
|
||||
Rec1.Focus();
|
||||
AuthCode.Focus();
|
||||
} else {
|
||||
AuthCode.MaxLength = 6;
|
||||
ToggleType.Content = "Use Recovery Code";
|
||||
AuthSubTitle.Content = "Enter your authorization code";
|
||||
AuthCode.Focus();
|
||||
}
|
||||
}
|
||||
async private void ReturnMFACodes(object sender, MouseButtonEventArgs e) {
|
||||
DataClient serviceClient = serviceClient = (DataClient)Application.Current.Properties["ServiceClient"];
|
||||
string code = Auth1.Text + Auth2.Text + Auth3.Text + Auth4.Text + Auth5.Text + Auth6.Text; //jeremyfix
|
||||
string code = AuthCode.Text;
|
||||
Logger.Debug("AuthMFA successful.");
|
||||
MfaRecoveryCodesResponse getcodes = await serviceClient.ReturnMFACodes(this._identity.Fingerprint, code);
|
||||
if (getcodes.Code != 0) {
|
||||
@@ -216,7 +163,7 @@ namespace ZitiDesktopEdge {
|
||||
}
|
||||
async private void GenerateMFACodes(object sender, MouseButtonEventArgs e) {
|
||||
DataClient serviceClient = serviceClient = (DataClient)Application.Current.Properties["ServiceClient"];
|
||||
string code = Rec1.Text + Rec2.Text + Rec3.Text + Rec4.Text + Rec5.Text + Rec6.Text; //jeremyfix
|
||||
string code = AuthCode.Text;
|
||||
MfaRecoveryCodesResponse gencodes = await serviceClient.GenerateMFACodes(this._identity.Fingerprint, code);
|
||||
if (gencodes.Code != 0) {
|
||||
Logger.Error("AuthMFA failed. " + gencodes.Message);
|
||||
@@ -240,7 +187,7 @@ namespace ZitiDesktopEdge {
|
||||
|
||||
async private void DoSetupAuthenticate(object sender, MouseButtonEventArgs e) {
|
||||
AuthBgColor.Color = Color.FromRgb(0, 104, 249);
|
||||
string code = SetupAuth1.Text + SetupAuth2.Text + SetupAuth3.Text + SetupAuth4.Text + SetupAuth5.Text + SetupAuth6.Text;
|
||||
string code = SetupCode.Text;
|
||||
|
||||
DataClient serviceClient = serviceClient = (DataClient)Application.Current.Properties["ServiceClient"];
|
||||
SvcResponse resp = await serviceClient.VerifyMFA(this._identity.Fingerprint, code);
|
||||
@@ -252,43 +199,21 @@ namespace ZitiDesktopEdge {
|
||||
}
|
||||
|
||||
async private void DoAuthenticate(object sender, MouseButtonEventArgs e) {
|
||||
string code = "";
|
||||
if (AuthRecoveryArea.Visibility == Visibility.Visible) {
|
||||
code = Rec1.Text + Rec2.Text + Rec3.Text + Rec4.Text + Rec5.Text + Rec6.Text + Rec7.Text + Rec8.Text;
|
||||
if (code.Length != 8) this.ShowError("You must enter a valid code");
|
||||
string code = AuthCode.Text;
|
||||
if (AuthCode.MaxLength==8) {
|
||||
if (code.Length != 8) this.ShowError("You must enter a valid recovery code");
|
||||
} else {
|
||||
code = Auth1.Text + Auth2.Text + Auth3.Text + Auth4.Text + Auth5.Text + Auth6.Text;
|
||||
if (code.Length != 6) this.ShowError("You must enter a valid code");
|
||||
|
||||
|
||||
DataClient serviceClient = serviceClient = (DataClient)Application.Current.Properties["ServiceClient"];
|
||||
SvcResponse authResult = await serviceClient.AuthMFA(this._identity.Fingerprint, code);
|
||||
if (authResult?.Code != 0) {
|
||||
Logger.Error("AuthMFA failed. " + authResult.Message);
|
||||
this.OnClose?.Invoke(false);
|
||||
} else {
|
||||
this.OnClose?.Invoke(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async private void DoAuthenticateb(object sender, MouseButtonEventArgs e) {
|
||||
string code = "";
|
||||
if (AuthRecoveryArea.Visibility == Visibility.Visible) {
|
||||
code = Rec1.Text + Rec2.Text + Rec3.Text + Rec4.Text + Rec5.Text + Rec6.Text + Rec7.Text + Rec8.Text;
|
||||
if (code.Length != 8) this.ShowError("You must enter a valid code");
|
||||
|
||||
DataClient serviceClient = serviceClient = (DataClient)Application.Current.Properties["ServiceClient"];
|
||||
SvcResponse authResult = await serviceClient.AuthMFA(this._identity.Fingerprint, code);
|
||||
if (authResult?.Code != 0) {
|
||||
Logger.Error("AuthMFA failed. " + authResult.Message);
|
||||
this.OnClose?.Invoke(false);
|
||||
} else {
|
||||
code = Auth1.Text + Auth2.Text + Auth3.Text + Auth4.Text + Auth5.Text + Auth6.Text;
|
||||
if (code.Length != 6) this.ShowError("You must enter a valid code");
|
||||
|
||||
|
||||
DataClient serviceClient = serviceClient = (DataClient)Application.Current.Properties["ServiceClient"];
|
||||
SvcResponse authResult = await serviceClient.VerifyMFA(this._identity.Fingerprint, code);
|
||||
if (authResult?.Code != 0) {
|
||||
Logger.Error("VerifyMFA failed. " + authResult.Message);
|
||||
} else {
|
||||
//success - hide the screen Jeremy
|
||||
}
|
||||
this.OnClose?.Invoke(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -332,5 +257,17 @@ namespace ZitiDesktopEdge {
|
||||
SecretButton.Content = "Show QR Code";
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleKey(object sender, KeyEventArgs e) {
|
||||
if (e.Key == Key.Return) {
|
||||
DoSetupAuthenticate(sender, null);
|
||||
}
|
||||
}
|
||||
|
||||
private void AuthCode_KeyUp(object sender, KeyEventArgs e) {
|
||||
if (e.Key == Key.Return) {
|
||||
DoAuthenticate(sender, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user