Skip to content

Commit

Permalink
#9963 Add warnings for Feststelltaste / Numlock
Browse files Browse the repository at this point in the history
  • Loading branch information
gdl-drw committed Aug 18, 2023
1 parent 9db4928 commit 92436be
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ private void SetOrClearMessage(string v1, bool v2, string v3)
public string PlainPassword { get; set; }
public bool ShowPlainPassword { get; set; } = false;
public bool HidePlainPassword => !ShowPlainPassword;

public string PasswordInputWarning { get; set; }
public bool ShowPasswordInputWarning { get; set; }

public LoginWindowViewModel_v2(IWebApiConfig webApiSettings)
{
Expand Down
5 changes: 5 additions & 0 deletions Gandalan.IDAS.WebApi.Client.Wpf/Dialogs/LoginWindow_v2.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@

<Label Grid.Column="0" Grid.Row="3" Content="Passwort:" VerticalAlignment="Center"></Label>
<Grid Grid.Column="1" Grid.Row="3" >
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
Expand All @@ -95,6 +99,7 @@
<Button x:Name="togglePasswordButton" Grid.Column="1" Margin="0,5,5,5" Padding="5" Click="TogglePassword_Click">
<Image x:Name="togglePasswordButtonImage" Source="pack://application:,,,/GDL.IDAS.WebApi.Client.WPF;component/Assets/Icons/view-off.png" Width="18" Height="18"></Image>
</Button>
<TextBlock Grid.Row="1" Margin="5,0,0,0" Text="{Binding PasswordInputWarning}" Foreground="Orange" d:Text="Feststelltaste ist aktiviert."/>
</Grid>

<CheckBox x:Name="checkBoxAuthToken" IsChecked="{Binding SaveCredentials}" Grid.Column="1" Grid.Row="4" Content="Anmeldung merken" VerticalContentAlignment="Center" Margin="5,5,10,5" Padding="2"/>
Expand Down
21 changes: 21 additions & 0 deletions Gandalan.IDAS.WebApi.Client.Wpf/Dialogs/LoginWindow_v2.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,27 @@ private void Window_KeyDown(object sender, KeyEventArgs e)
{
_viewModel.ShowServerSelection = !_viewModel.ShowServerSelection;
}
if (Keyboard.IsKeyToggled(Key.CapsLock) || !Keyboard.IsKeyToggled(Key.NumLock))
{
_viewModel.ShowPasswordInputWarning = true;
_viewModel.PasswordInputWarning = "";
if (Keyboard.IsKeyToggled(Key.CapsLock))
{
_viewModel.PasswordInputWarning += "Feststelltaste ist aktiviert. ";
}
if (!Keyboard.IsKeyToggled(Key.NumLock))
{
_viewModel.PasswordInputWarning += "Numlock ist nicht aktiviert. ";
}
}
else
{
if (_viewModel.ShowPasswordInputWarning) // only reset if warning is shown
{
_viewModel.ShowPasswordInputWarning = false;
_viewModel.PasswordInputWarning = null;
}
}
}

private void TogglePassword_Click(object sender, RoutedEventArgs e)
Expand Down

0 comments on commit 92436be

Please sign in to comment.