diff --git a/src/KeyKeeper/Views/CreateVaultDialog.axaml b/src/KeyKeeper/Views/CreateVaultDialog.axaml
index fe07713..05f83c2 100644
--- a/src/KeyKeeper/Views/CreateVaultDialog.axaml
+++ b/src/KeyKeeper/Views/CreateVaultDialog.axaml
@@ -54,12 +54,32 @@
-
+
+
+
+
+
+
+
+
+
+
+
-
+
\ No newline at end of file
diff --git a/src/KeyKeeper/Views/CreateVaultDialog.axaml.cs b/src/KeyKeeper/Views/CreateVaultDialog.axaml.cs
index 2cb34c4..b9f4196 100644
--- a/src/KeyKeeper/Views/CreateVaultDialog.axaml.cs
+++ b/src/KeyKeeper/Views/CreateVaultDialog.axaml.cs
@@ -2,7 +2,10 @@
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Interactivity;
+using Avalonia.Media;
using Avalonia.Platform.Storage;
+using System;
+using System.Text.RegularExpressions;
namespace KeyKeeper.Views
{
@@ -53,6 +56,68 @@ namespace KeyKeeper.Views
{
UpdateCreateButtonState();
PasswordErrorText.IsVisible = false;
+
+ // Обновляем индикатор сложности пароля
+ string password = PasswordBox.Text ?? "";
+ UpdatePasswordStrengthIndicator(password);
+ }
+
+ private void UpdatePasswordStrengthIndicator(string password)
+ {
+ if (PasswordStrengthFill == null || PasswordStrengthIndicator == null)
+ return;
+
+ if (string.IsNullOrEmpty(password))
+ {
+ PasswordStrengthFill.Width = 0;
+ return;
+ }
+
+ int strength = CalculatePasswordStrength(password);
+
+ double maxWidth = PasswordStrengthIndicator.Bounds.Width;
+ if (maxWidth <= 0) maxWidth = 200;
+
+ PasswordStrengthFill.Width = (strength / 100.0) * maxWidth;
+
+ if (strength < 20)
+ {
+ PasswordStrengthFill.Background = new SolidColorBrush(Colors.Red);
+ }
+ else if (strength < 50)
+ {
+ PasswordStrengthFill.Background = new SolidColorBrush(Colors.Orange);
+ }
+ else if (strength < 70)
+ {
+ PasswordStrengthFill.Background = new SolidColorBrush(Colors.Gold);
+ }
+ else
+ {
+ PasswordStrengthFill.Background = new SolidColorBrush(Colors.Green);
+ }
+ }
+
+ private int CalculatePasswordStrength(string password)
+ {
+ int score = 0;
+
+ if (password.Length >= 8) score += 20;
+ if (password.Length >= 12) score += 20;
+ if (password.Length >= 16) score += 15;
+
+ if (Regex.IsMatch(password, @"\d")) score += 10;
+
+ if (Regex.IsMatch(password, @"[a-z]")) score += 15;
+
+ if (Regex.IsMatch(password, @"[A-Z]")) score += 15;
+
+ if (Regex.IsMatch(password, @"[!@#$%^&*()_+\-=\[\]{};':""\\|,.<>\/?]")) score += 20;
+
+ var uniqueChars = new System.Collections.Generic.HashSet(password).Count;
+ score += Math.Min(20, uniqueChars * 2);
+
+ return Math.Min(100, score);
}
private void UpdateCreateButtonState()
diff --git a/src/KeyKeeper/Views/ErrorDialog.axaml b/src/KeyKeeper/Views/ErrorDialog.axaml
index 89faf82..fd9cfc2 100644
--- a/src/KeyKeeper/Views/ErrorDialog.axaml
+++ b/src/KeyKeeper/Views/ErrorDialog.axaml
@@ -32,16 +32,16 @@
-
-