private void LoginButton_Click(object sender, EventArgs e) { string user = UsernameTextBox.Text; string pass = PasswordTextBox.Text; if (newlogin.Verify(user, pass)) { //login to dashboard if (newlogin.IspwdReset()) { //show new/confirm password textboxes and update password PasswordLabel.Hide(); NewPasswordLabel.Show(); ConfirmPasswordLabel.Show(); ConfirmPasswordTextBox.Show(); PasswordTextBox.Text = ""; MessageBox.Show("Please update your password."); LoginButton.Hide(); ConfirmLoginButton.Show(); } else { //MessageBox.Show("Login successfull!"); this.Hide(); Dashboard db = new Dashboard(newlogin.GetUserID()); db.Show(); } } }
private bool IsFormValid() { if (OldPasswordTextBox.Text.Trim() == string.Empty) { MessageBox.Show("Old password is Required.", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error); OldPasswordTextBox.Focus(); return(false); } if (NewPasswordTextBox.Text.Trim() == string.Empty) { MessageBox.Show("New password is Required.", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error); NewPasswordTextBox.Focus(); return(false); } if (ConfirmPasswordTextBox.Text.Trim() == string.Empty) { MessageBox.Show("Confirm password is Required.", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error); ConfirmPasswordTextBox.Focus(); return(false); } if (NewPasswordTextBox.Text.Trim() != ConfirmPasswordTextBox.Text.Trim()) { MessageBox.Show("New and Confirm password does not match.", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error); ConfirmPasswordTextBox.Focus(); return(false); } return(true); }
private void ResetFormControl() { NewPasswordTextBox.Clear(); OldPasswordTextBox.Clear(); ConfirmPasswordTextBox.Clear(); OldPasswordTextBox.Focus(); }
private void SecureSettingsShow() { ChangePassLabel.Show(); OldPasswordTextBox.Show(); NewPasswordTextBox.Show(); ConfirmPasswordTextBox.Show(); ChangeButton.Show(); materialDivider1.Show(); CreateKeyLabel.Show(); SecureKeyDescLabel.Show(); CreateKeyButton.Show(); WarningLabel.Show(); }
public bool validar() { bool paso = true; if (string.IsNullOrWhiteSpace(NombresTextBox.Text)) { SuperErrorProvider.SetError(NombresTextBox, "Este campo no puede estar vacio"); NombresTextBox.Focus(); paso = false; } if (string.IsNullOrWhiteSpace(CorreoTextBox.Text)) { SuperErrorProvider.SetError(CorreoTextBox, "Este campo no puede estar vacio"); CorreoTextBox.Focus(); paso = false; } if (string.IsNullOrWhiteSpace(UsuarioTextBox.Text)) { SuperErrorProvider.SetError(UsuarioTextBox, "Este campo no puede estar vacio"); UsuarioTextBox.Focus(); paso = false; } if (string.IsNullOrWhiteSpace(ConfirmPasswordTextBox.Text)) { SuperErrorProvider.SetError(ConfirmPasswordTextBox, "Este campo no puede estar vacio"); ConfirmPasswordTextBox.Focus(); paso = false; } if (!ConfirmPasswordTextBox.Text.Equals(PasswordTextBox.Text)) { SuperErrorProvider.SetError(ConfirmPasswordTextBox, "Ambos campos deben coincidir"); ConfirmPasswordTextBox.Focus(); SuperErrorProvider.SetError(PasswordTextBox, "Ambos campos deben coincidir"); PasswordTextBox.Focus(); paso = false; } if (string.IsNullOrWhiteSpace(PasswordTextBox.Text)) { SuperErrorProvider.SetError(PasswordTextBox, "Este campo no puede estar vacio"); PasswordTextBox.Focus(); paso = false; } return(paso); }
private void ConfirmPasswordTextBox_Validating(object sender, CancelEventArgs e) { if (this.ConfirmPasswordTextBox.Text != this.PasswordTextBox.Text) { this.errorProvider1.SetError(this.ConfirmPasswordTextBox, "Password and Confirm must be the same"); e.Cancel = true; PasswordTextBox.Clear(); ConfirmPasswordTextBox.Clear(); } else { this.errorProvider1.SetError(this.ConfirmPasswordTextBox, ""); } }
private void SubmitButton_Click(object sender, RoutedEventArgs e) { string fullName = FullNameTextBox.Text; string email = EmailTextBox.Text; string password = Core.Models.User.GetHash(PasswordTextBox.Password); string passwordConf = Core.Models.User.GetHash(ConfirmPasswordTextBox.Password); if (string.IsNullOrWhiteSpace(fullName)) { FullNameTextBox.Focus(); return; } if (string.IsNullOrWhiteSpace(email)) { EmailTextBox.Focus(); return; } if (_storage.Users.Items.FirstOrDefault(u => u.Email.ToLower() == email.ToLower()) != null) { MessageBox.Show("Пользователь с таким Email уже существует!"); return; } if (string.IsNullOrWhiteSpace(PasswordTextBox.Password)) { PasswordTextBox.Focus(); return; } if (string.IsNullOrWhiteSpace(ConfirmPasswordTextBox.Password)) { ConfirmPasswordTextBox.Focus(); return; } if (password != passwordConf) { MessageBox.Show("Пароли не совпадают!", "Ошибка"); return; } User NewUser = new User { FullName = fullName, Password = password, Email = email, Goals = new List <Goal>() }; _storage.AddUser(NewUser); _storage.Users.Add(NewUser); Close(); }
protected void RegisterButton_Click(object sender, EventArgs e) { using (chandureddyEntities db = new chandureddyEntities()) { string userName = UserNameTextBox.Text; string password = PasswordTextBox.Text; string confPass = ConfirmPasswordTextBox.Text; //check user name exists in db var userNameCheck = (from UserInformation in db.User_Information where UserInformation.username == userName select UserInformation); if (userNameCheck.Any()) { ClientScript.RegisterStartupScript(GetType(), "validate", "alert('UserName already EXISTS.');", true); } else { if (password == confPass) { if (password.Length > 5) { User_Information newUser = new User_Information(); newUser.username = userName; newUser.password = password; db.User_Information.Add(newUser); db.SaveChanges(); Response.Redirect("Default.aspx"); } else { ClientScript.RegisterStartupScript(GetType(), "validate", "alert('Password must be atleast 6 char long.');", true); PasswordTextBox.Text = ""; PasswordTextBox.Focus(); } } else { ClientScript.RegisterStartupScript(GetType(), "validate", "alert('Passwords dont match.');", true); ConfirmPasswordTextBox.Text = ""; ConfirmPasswordTextBox.Focus(); } } } }
/// <summary> /// Enter text into the 'Confirm Password' text box /// </summary> /// <param name="password">The applicants password</param> public void EnterConfirmPassword(string password) { ConfirmPasswordTextBox.SendKeys(password); }
private void ChangePasswordButton_Click(object sender, EventArgs e) { User user = new User() { UserName = UserNameTextBox.Text.Trim(), Password = OriginalPasswordTextBox.Text.Trim() }; Response response = new Response(); if (string.IsNullOrEmpty(UserNameTextBox.Text.Trim())) { UserNameTextBox.Focus(); UserNameErrorProvider.SetError(UserNameTextBox, "UserName can't be vacant!"); } else { UserNameErrorProvider.SetError(UserNameTextBox, ""); if (string.IsNullOrEmpty(OriginalPasswordTextBox.Text.Trim())) { OriginalPasswordTextBox.Focus(); OriginalPasswordErrorProvider.SetError(OriginalPasswordTextBox, "OriginalPassword can't be vacant!"); } else { OriginalPasswordErrorProvider.SetError(OriginalPasswordTextBox, ""); if (string.IsNullOrEmpty(NewPasswordTextBox.Text.Trim())) { NewPasswordTextBox.Focus(); NewPasswordErrorProvider.SetError(NewPasswordTextBox, "NewPassword can't be vacant!"); } else { NewPasswordErrorProvider.SetError(NewPasswordTextBox, ""); if (string.IsNullOrEmpty(ConfirmPasswordTextBox.Text.Trim())) { ConfirmPasswordTextBox.Focus(); ConfirmPasswordErrorProvider.SetError(ConfirmPasswordTextBox, "ConfirmPassword can't be vacant!"); } else { try { response = new UserService().Authentication(user); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } if (string.IsNullOrEmpty(response.Message)) { if (NewPasswordTextBox.Text.Trim() != OriginalPasswordTextBox.Text.Trim()) { if (ConfirmPasswordTextBox.Text.Trim() == NewPasswordTextBox.Text.Trim()) { try { user.UserId = new UserService().GetUserIdByUserName(user.UserName); user.Password = ConfirmPasswordTextBox.Text.Trim(); response = new UserService().ChangePassword(user); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } if (response.IsFailed) { MessageBox.Show("Changing password fails", "System prompt", MessageBoxButtons.OK, MessageBoxIcon.Information); UserNameTextBox.Focus(); UserNameTextBox.Text = string.Empty; OriginalPasswordTextBox.Text = string.Empty; NewPasswordTextBox.Text = string.Empty; ConfirmPasswordTextBox.Text = string.Empty; } else { MessageBox.Show("Changing password succeeds", "System prompt", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } else { MessageBox.Show("Please repeat new password again.", "System prompt", MessageBoxButtons.OK, MessageBoxIcon.Information); NewPasswordTextBox.Text = string.Empty; ConfirmPasswordTextBox.Text = string.Empty; } } else { MessageBox.Show("New password and current password are same.", "System prompt", MessageBoxButtons.OK, MessageBoxIcon.Information); NewPasswordTextBox.Text = string.Empty; ConfirmPasswordTextBox.Text = string.Empty; } } else { MessageBox.Show(response.Message, "System prompt", MessageBoxButtons.OK, MessageBoxIcon.Information); UserNameTextBox.Focus(); UserNameTextBox.Text = string.Empty; OriginalPasswordTextBox.Text = string.Empty; NewPasswordTextBox.Text = string.Empty; ConfirmPasswordTextBox.Text = string.Empty; } } } } } }
public void EnterConfirmPassword(string phone) => ConfirmPasswordTextBox.SendKeys(phone);
public bool ValidateEdition() { String errors = ""; String line = ""; bool focusSetted = false; if (String.IsNullOrWhiteSpace(NameTextBox.Text) && String.IsNullOrWhiteSpace(FirstNameTextBox.Text)) { errors += line + "Name and first name can't be empty."; line = "\n"; if (!focusSetted) { if (String.IsNullOrWhiteSpace(NameTextBox.Text)) { NameTextBox.Focus(); NameTextBox.SelectAll(); } else { FirstNameTextBox.Focus(); FirstNameTextBox.SelectAll(); } focusSetted = true; } } if (String.IsNullOrWhiteSpace(EmailTextBox.Text)) { //errors += line + "Email can't be empty."; //line = "\n"; //if (!focusSetted) //{ // EmailTextBox.Focus(); // EmailTextBox.SelectAll(); // focusSetted = true; //} } else if (!UserUtil.validateEmail(EmailTextBox.Text)) { errors += line + "Wrong email format."; line = "\n"; if (!focusSetted) { EmailTextBox.Focus(); EmailTextBox.SelectAll(); focusSetted = true; } } if (String.IsNullOrWhiteSpace(LoginTextBox.Text)) { errors += line + "Login can't be empty."; line = "\n"; if (!focusSetted) { LoginTextBox.Focus(); LoginTextBox.SelectAll(); focusSetted = true; } } if (String.IsNullOrWhiteSpace(PasswordTextBox.Password)) { errors += line + "Password can't be empty."; line = "\n"; if (!focusSetted) { PasswordTextBox.Focus(); PasswordTextBox.SelectAll(); focusSetted = true; } } else if (!Util.UserUtil.validatePassword(PasswordTextBox.Password, ConfirmPasswordTextBox.Password)) { errors += line + "Password does not match."; line = "\n"; if (!focusSetted) { ConfirmPasswordTextBox.Focus(); ConfirmPasswordTextBox.SelectAll(); focusSetted = true; } } bool isValid = String.IsNullOrWhiteSpace(errors); this.Console.Text = errors; this.Console.Visibility = isValid ? Visibility.Collapsed : Visibility.Visible; return(isValid); }