protected void ChangePassword(string oldPwd, string newPwd) { if (!UserView.GetInstance().IsPatient) { Staff staff = StaffDB.GetByID(Convert.ToInt32(Session["StaffID"])); bool validUser = (staff != null); if (!validUser) { this.FailureText.Text = "Invalid staff member. Plase contact the system administrator." + "<br />"; ResetFields(); return; } if (staff.Pwd != oldPwd) { this.FailureText.Text = "Old password is not correct."; ResetFields(); return; } if (newPwd.Length < 6) { this.FailureText.Text = "New passwords must be at least 6 characters."; ResetFields(); return; } StaffDB.UpdatePwd(staff.StaffID, newPwd); CurrentPassword.Attributes.Add("value", ""); NewPassword.Attributes.Add("value", ""); ConfirmNewPassword.Attributes.Add("value", ""); this.FailureText.Text = "Password successfully changed!"; Response.Redirect("~/Account/ChangePasswordSuccessV2.aspx"); } else { Patient patient = PatientDB.GetByID(Convert.ToInt32(Session["PatientID"])); bool validUser = (patient != null); if (!validUser) { this.FailureText.Text = "Invalid patient. Plase contact the system administrator." + "<br />"; ResetFields(); return; } if (patient.Pwd != oldPwd) { this.FailureText.Text = "Old password is not correct."; ResetFields(); return; } if (newPwd.Length < 6) { this.FailureText.Text = "New passwords must be at least 6 characters."; ResetFields(); return; } PatientDB.UpdatePwd(patient.PatientID, newPwd); CurrentPassword.Attributes.Add("value", ""); NewPassword.Attributes.Add("value", ""); ConfirmNewPassword.Attributes.Add("value", ""); this.FailureText.Text = "Password successfully changed!"; Response.Redirect("~/BookingsV2.aspx?orgs=" + Session["OrgID"] + "&ndays=3"); } }