Exemple #1
0
 private void btnLogin_Click(object sender, EventArgs e)
 {
     parentId = 0;
     if (txtEmail.Text == string.Empty)
     {
         MyMessageBox.MyShow("Enter email!");
     }
     else if (txtPass.Text == string.Empty)
     {
         MyMessageBox.MyShow("Enter password!");
     }
     else
     {
         parentId = GetDataDB.verifyLogin(txtEmail.Text, GetDataDB.GetHash(txtPass.Text));
         if (parentId == -1)
         {
             MyMessageBox.MyShow("Login or password is incorrect");
         }
         else//залогинились успешно
         {
             DialogResult = DialogResult.OK;
             Close();
         }
     }
 }
Exemple #2
0
 private void btnLogin_Click(object sender, EventArgs e)
 {
     parentId = 0;
     if (txtEmail.Text == string.Empty)
     {
         MyMessageBox.MyShow("Ввеите email!");
     }
     else if (txtPass.Text == string.Empty)
     {
         MyMessageBox.MyShow("Введите пароль!");
     }
     else
     {
         parentId = GetDataDB.verifyLogin(txtEmail.Text, GetDataDB.GetHash(txtPass.Text));
         if (parentId == -1)
         {
             MyMessageBox.MyShow("Еmail или пароль не корректны! Попробуй ещё.");
         }
         else//залогинились успешно
         {
             DialogResult = DialogResult.OK;
             Close();
         }
     }
 }
Exemple #3
0
 private void btnRegister_Click(object sender, EventArgs e)
 {
     if (txtFirstName.Text == string.Empty)
     {
         MyMessageBox.MyShow("Введите имя!");
     }
     else if (txtLastName.Text == string.Empty)
     {
         MyMessageBox.MyShow("Введите фамилию!");
     }
     else if (txtEmail.Text == string.Empty)
     {
         MyMessageBox.MyShow("Введите email!");
     }
     else if (!isValidEmail(txtEmail.Text))
     {
         MyMessageBox.MyShow("Введите настоящий email!");
     }
     else if (txtPass.Text == string.Empty)
     {
         MyMessageBox.MyShow("Введите пароль!");
     }
     else if (txtPassCheck.Text == string.Empty)
     {
         MyMessageBox.MyShow("Введите проверочный пароль!");
     }
     else if (txtPassCheck.Text != txtPass.Text)
     {
         MyMessageBox.MyShow("Введенные пароли не совпадают!");
     }
     else if (txtPass.Text.Length < 8 || txtPassCheck.TextLength < 8)
     {
         MyMessageBox.MyShow("Минимальная длина пароля - 8 символов");
     }
     else if (txtPass.Text.Length > 16 || txtPassCheck.TextLength > 16)
     {
         MyMessageBox.MyShow("Максимальная длина пароля - 16 символов");
     }
     else
     {
         try
         {
             GetDataDB.addParent(txtFirstName.Text, txtLastName.Text, txtEmail.Text, GetDataDB.GetHash(txtPass.Text));//добавить в таблицу нового пользователя
             DialogResult = DialogResult.OK;
             Close();
         }
         catch (System.Data.SqlClient.SqlException)
         {
             MyMessageBox.MyShow("Пользователь с таким email существует!");
         }
     }
 }