From a35c382c4b908ff3bec0301fffe5689c795f937b Mon Sep 17 00:00:00 2001 From: Maxim Slipenko Date: Tue, 24 May 2022 13:49:52 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D1=8F?= =?UTF-8?q?=D0=B5=D1=82=20=D1=84=D0=BE=D1=80=D0=BC=D1=83=20=D0=B0=D0=B4?= =?UTF-8?q?=D0=BC=D0=B8=D0=BD=D0=B8=D1=81=D1=82=D1=80=D0=B8=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Authorization.cs | 2 +- AuthorizationForm.cs | 6 ++++++ EditUserForm.cs | 6 ++++++ RegistrationForm.cs | 6 ++++++ SettingsForm.cs | 6 ++++++ 5 files changed, 25 insertions(+), 1 deletion(-) diff --git a/Authorization.cs b/Authorization.cs index 71c3b5a..e64cfa9 100644 --- a/Authorization.cs +++ b/Authorization.cs @@ -28,7 +28,7 @@ namespace AwesomeEmailExtractor return new User(reader.GetInt32(0), reader.GetString(1), (UserRoles)reader.GetInt32(2)); } - throw new Exception("Пользователь не найден!"); + throw new Exception("Неверные данные для входа!"); } public static User Register(string login, string password) diff --git a/AuthorizationForm.cs b/AuthorizationForm.cs index 741cb61..cee06d7 100644 --- a/AuthorizationForm.cs +++ b/AuthorizationForm.cs @@ -21,6 +21,12 @@ namespace AwesomeEmailExtractor { try { + if (string.IsNullOrEmpty(entryLogin.Text) || string.IsNullOrEmpty(entryPassword.Text)) + { + MessageBox.Show("Введите логин и пароль"); + return; + } + Globals.currentUser = Authorization.Login(entryLogin.Text, entryPassword.Text); Logs.Log(Globals.currentUser, Logs.Action.Login, new Dictionary()); diff --git a/EditUserForm.cs b/EditUserForm.cs index 73024ba..91b4fbc 100644 --- a/EditUserForm.cs +++ b/EditUserForm.cs @@ -35,6 +35,12 @@ namespace AwesomeEmailExtractor private void submitButton_Click(object sender, EventArgs e) { + if (loginTextBox.Text.Length == 0) + { + MessageBox.Show("Логин не может быть пустым!"); + return; + } + AdminUtils adminUtils = new AdminUtils(Globals.currentUser); User editedUser = new User(User.ID, loginTextBox.Text, (UserRoles)roleComboBox.SelectedIndex); diff --git a/RegistrationForm.cs b/RegistrationForm.cs index 308f39b..f576b67 100644 --- a/RegistrationForm.cs +++ b/RegistrationForm.cs @@ -19,6 +19,12 @@ namespace AwesomeEmailExtractor private void registerButton_Click(object sender, EventArgs e) { + if (string.IsNullOrEmpty(entryLogin.Text) || string.IsNullOrEmpty(entryPassword.Text)) + { + MessageBox.Show("Введите логин и пароль!"); + return; + } + if (!string.Equals(entryPassword.Text, entryRePassword.Text)) { MessageBox.Show("Пароли не совпадают!"); diff --git a/SettingsForm.cs b/SettingsForm.cs index 287829d..1cde078 100644 --- a/SettingsForm.cs +++ b/SettingsForm.cs @@ -36,6 +36,12 @@ namespace AwesomeEmailExtractor private void changePasswordButton_Click(object sender, EventArgs e) { + if (string.IsNullOrEmpty(entryNewPassword.Text)) + { + MessageBox.Show("Введите пароль!"); + return; + } + if (!string.Equals(entryNewPassword.Text, entryRePassword.Text)) { MessageBox.Show("Пароли не совпадают!");