public bool sendCode(string contact) { if (Validation.validationEmail(contact).Length != 0) { SqlMaster sqlMaster = new SqlMaster(); User user = sqlMaster.getUser("login", contact); return(Email.sendСode(this.codeString, user.email)); } else { return(Email.sendСode(this.codeString, contact)); } }
private void ButtonSignUp_Click(object sender, RoutedEventArgs e) { TextBlockSignUpLoginError.Text = Validation.validationLogin(TextBoxSignUpLogin.Text); TextBlockSignUpNameError.Text = Validation.validationName(TextBoxSignUpName.Text); TextBlockSignUpPhoneError.Text = Validation.validationPhone(TextBoxSignUpPhone.Text); TextBlockSignUpEmailError.Text = Validation.validationEmail(TextBoxSignUpEmail.Text); TextBlockSignUpPasswordError.Text = Validation.validationPassword(TextBoxSignUpPassword.Text); TextBlockSignUpConfirmPasswordError.Text = Validation.validationConfirmPassword( TextBoxSignUpPassword.Text, TextBoxSignUpConfirmPassword.Text ); if ( TextBlockSignUpLoginError.Text.Length == 0 && TextBlockSignUpNameError.Text.Length == 0 && TextBlockSignUpPhoneError.Text.Length == 0 && TextBlockSignUpEmailError.Text.Length == 0 && TextBlockSignUpPasswordError.Text.Length == 0 && TextBlockSignUpConfirmPasswordError.Text.Length == 0 ) { PackIconConnection.Visibility = Visibility.Visible; SqlMaster sqlMaster = new SqlMaster(); if (sqlMaster.isConnected()) { TextBlockSignUpLoginError.Text = sqlMaster.uniqueLogin(TextBoxSignUpLogin.Text); TextBlockSignUpEmailError.Text = sqlMaster.uniqueEmail(TextBoxSignUpEmail.Text); TextBlockSignUpPhoneError.Text = sqlMaster.uniquePhone(TextBoxSignUpPhone.Text); if ( TextBlockSignUpLoginError.Text.Length == 0 && TextBlockSignUpPhoneError.Text.Length == 0 && TextBlockSignUpEmailError.Text.Length == 0 ) { sqlMaster.saveUser( TextBoxSignUpLogin.Text, TextBoxSignUpName.Text, TextBoxSignUpPhone.Text, TextBoxSignUpEmail.Text, TextBoxSignUpPassword.Text ); } } PackIconConnection.Visibility = Visibility.Hidden; } }
private void ButtonNewPasswordResetPassword_Click(object sender, RoutedEventArgs e) { TextBlockNewPasswordPasswordError.Text = Validation.validationPassword(TextBoxNewPasswordPassword.Text); TextBlockNewPasswordConfirmPasswordError.Text = Validation.validationConfirmPassword(TextBoxNewPasswordPassword.Text, TextBoxNewPasswordConfirmPassword.Text); if (TextBlockNewPasswordPasswordError.Text.Length == 0 && TextBlockNewPasswordConfirmPasswordError.Text.Length == 0) { SqlMaster sqlMaster = new SqlMaster(); if (Validation.validationEmail(TextBoxNewPasswordLogin.Text).Length == 0) { User user = sqlMaster.getUser("email", TextBoxNewPasswordLogin.Text); sqlMaster.changePassword(TextBoxNewPasswordPassword.Text, user.login); } else { sqlMaster.changePassword(TextBoxNewPasswordPassword.Text, TextBoxNewPasswordLogin.Text); } } }
private void ButtonLogIn_Click(object sender, RoutedEventArgs e) { TextBlockLogInLoginError.Text = Validation.validationLogin(TextBoxLogInLogin.Text); TextBlockLogInPasswordError.Text = Validation.validationPassword(PasswordBoxLogInPassword.Password); if (TextBlockLogInLoginError.Text.Length == 0 && TextBlockLogInPasswordError.Text.Length == 0) { PackIconConnection.Visibility = Visibility.Visible; SqlMaster sqlMaster = new SqlMaster(); if (sqlMaster.isConnected()) { if (sqlMaster.userExist(TextBoxLogInLogin.Text, PasswordBoxLogInPassword.Password)) { OurMessageBox.Show("Успех!", "Добро пожаловать", "Вы успешно авторизовались!"); } else { OurMessageBox.Show("Не удача!", "Хм... Кажется что-то пошло не так.", "Неверный логин или пароль."); } } PackIconConnection.Visibility = Visibility.Hidden; } }