Done
This commit is contained in:
parent
1057a643f8
commit
af669e2f0b
@ -51,7 +51,10 @@
|
||||
<TextBlock Text="Повтор пароля:" VerticalAlignment="Top" Foreground="Black"/>
|
||||
<TextBox Width="250" HorizontalAlignment="Left" Watermark="Re-enter password" x:Name="TextRePassword"/>
|
||||
|
||||
<CheckBox Content="Видимый пароль" HorizontalAlignment="Right" Foreground="Black"/>
|
||||
<!-- <CheckBox Content="Видимый пароль" HorizontalAlignment="Right" Foreground="Black"/> -->
|
||||
<CheckBox Content="Видимый пароль" HorizontalAlignment="Right" Name="PasswordVisibilityCheckBox" Checked="PasswordVisibilityCheckBox_Checked" Unchecked="PasswordVisibilityCheckBox_Unchecked"/>
|
||||
|
||||
<TextBlock x:Name="PasswordErrorText" Foreground="Red" IsVisible="False"/>
|
||||
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Spacing="10">
|
||||
<Button Content="Ok" HorizontalAlignment="Right" Click="OkButton_OnClick" Foreground="Black" Background="LightGray"/>
|
||||
|
@ -98,8 +98,16 @@ public partial class RegJhuri : Window
|
||||
var returnPassword = TextPassword.Text;
|
||||
var returnPassword2 = TextRePassword.Text;
|
||||
if (returnPassword != returnPassword2)
|
||||
|
||||
if (returnPassword != returnPassword2)
|
||||
{
|
||||
Console.WriteLine("Пароли не совпадают.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ValidatePassword(returnPassword))
|
||||
{
|
||||
Console.WriteLine("Пароли не совпадают.");
|
||||
Console.WriteLine("Пароль не соответствует требованиям.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -160,4 +168,43 @@ public partial class RegJhuri : Window
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private bool ValidatePassword(string password)
|
||||
{
|
||||
if (password.Length < 6)
|
||||
{
|
||||
PasswordErrorText.Text = "Пароль должен быть не менее 6 символов.";
|
||||
PasswordErrorText.IsVisible = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!password.Any(char.IsDigit))
|
||||
{
|
||||
PasswordErrorText.Text = "Пароль должен содержать хотя бы одну цифру.";
|
||||
PasswordErrorText.IsVisible = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!password.Any(char.IsLetter))
|
||||
{
|
||||
PasswordErrorText.Text = "Пароль должен содержать хотя бы одну букву.";
|
||||
PasswordErrorText.IsVisible = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
PasswordErrorText.IsVisible = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
private void PasswordVisibilityCheckBox_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
TextPassword.PasswordChar = '\0';
|
||||
TextRePassword.PasswordChar = '\0';
|
||||
}
|
||||
|
||||
private void PasswordVisibilityCheckBox_Unchecked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
TextPassword.PasswordChar = '•';
|
||||
TextRePassword.PasswordChar = '•';
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 537 KiB |
Binary file not shown.
After Width: | Height: | Size: 273 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -13,7 +13,7 @@ using System.Reflection;
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("demo15012025")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+fe0ba9320c7b42e3e952670b2be10fb55490eb04")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1057a643f8eed5ef9fa1dce6f12c003e060abdd6")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("demo15012025")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("demo15012025")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
@ -1 +1 @@
|
||||
9be47889b8d73cd0463d35e7868addd6cbb3ce57cb06c77fc2cd288c4821de5c
|
||||
4588be067bf91c0cab9d42363e9d335da1e75434b3d2935fdcac2bcc10f05682
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user