private bool PasswordInputOK(string sPswd) { bool bln = false; if (sPswd == "") { MessageBox.Show("Please fill in Password"); } else { if (!CMain.HasLetter(sPswd)) { MessageBox.Show("Password must contain at least one letter [a-z]"); } else { if (!CMain.HasNumber(sPswd)) { MessageBox.Show("Password must contain at least one number [0-9]"); } else { bln = true; } } } return(bln); }
protected void btnChange_Click(object sender, EventArgs e) { string sPswd = txtPass.Text.Trim(); if (sPswd == "") { MessageBox.Show("Please fill in Password"); } else { if (!CMain.HasLetter(sPswd)) { MessageBox.Show("Password must contain at least one letter [a-z]"); } else { if (!CMain.HasNumber(sPswd)) { MessageBox.Show("Password must contain at least one number [0-9]"); } else { string sConfirm = txtConfirm.Text.Trim(); if (sConfirm == "") { MessageBox.Show("Please confirm your new password"); } else { if (sConfirm != sPswd) { MessageBox.Show("Confirmed password does not match"); } else { string errMsg = DoChangePassword(sPswd); if (errMsg == "") { MessageBox.Show("Your password has been successfully changed"); Response.Redirect("HomePage.aspx"); } } } } } } }