mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
Password complexity indicator works again in new databases (but solution is dirty...)
Copy button in text boxes fully works
This commit is contained in:
@@ -1,17 +1,24 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using Windows.Storage.Pickers;
|
||||
using Windows.System;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Input;
|
||||
using ModernKeePass.Common;
|
||||
using ModernKeePass.Events;
|
||||
using ModernKeePassLib.Cryptography;
|
||||
|
||||
// Pour en savoir plus sur le modèle d'élément Contrôle utilisateur, consultez la page http://go.microsoft.com/fwlink/?LinkId=234236
|
||||
|
||||
namespace ModernKeePass.Controls
|
||||
{
|
||||
public sealed partial class OpenDatabaseUserControl
|
||||
public sealed partial class OpenDatabaseUserControl: INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
public double PasswordComplexityIndicator { get; private set; }
|
||||
|
||||
public bool CreateNew
|
||||
{
|
||||
get { return (bool)GetValue(CreateNewProperty); }
|
||||
@@ -26,7 +33,7 @@ namespace ModernKeePass.Controls
|
||||
|
||||
public string Password
|
||||
{
|
||||
get { return (string)GetValue(PasswordProperty); }
|
||||
get { return (string) GetValue(PasswordProperty); }
|
||||
set { SetValue(PasswordProperty, value); }
|
||||
}
|
||||
public static readonly DependencyProperty PasswordProperty =
|
||||
@@ -35,7 +42,12 @@ namespace ModernKeePass.Controls
|
||||
typeof(string),
|
||||
typeof(OpenDatabaseUserControl),
|
||||
new PropertyMetadata(string.Empty, (o, args) => { }));
|
||||
|
||||
|
||||
private void NotifyPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
public OpenDatabaseUserControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -88,5 +100,12 @@ namespace ModernKeePass.Controls
|
||||
app.Database.KeyFile = file;
|
||||
StatusTextBlock.Text = $"Key file: {file.Name}";
|
||||
}
|
||||
|
||||
private void PasswordBox_OnPasswordChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var passwordBox = sender as PasswordBox;
|
||||
PasswordComplexityIndicator = QualityEstimation.EstimatePasswordBits(passwordBox?.Password.ToCharArray());
|
||||
NotifyPropertyChanged("PasswordComplexityIndicator");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user