protected void btnSaveChanges_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(txtCurrentEmail.Text) || String.IsNullOrEmpty(txtCurrentPassword.Text) || String.IsNullOrEmpty(txtNewPassword.Text)) Page.ClientScript.RegisterStartupScript(this.GetType(), "Script", "<script> alert('All fields are required.Thank you!'); </script>"); SqlCommand pass = new SqlCommand(); DBConnect objDB = new DBConnect(); //string currentPassword = (string)pass.ExecuteScalar(); //if (currentPassword == txtCurrentPassword.Text) // { } //else // lblMsg.Text = "Please enter your current password again!"; Salt salt = new Salt(); string currentEmail = txtCurrentEmail.Text; string currentPassword = txtCurrentPassword.Text; string newPassword1 = txtNewPassword.Text; customer customerObj=new customer(); int result = customerObj.ResetPassword(currentEmail, currentPassword, newPassword1, salt.ToString(),role); if (result == 0) lblMsg.Text = "The password you entered is incorrect!"; else if (result == 1) lblMsg.Text = "The password was changed successfully."; // Response.Redirect("LoginPage.aspx"); }
protected void btnReset_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(txtNewPassword1.Text) || String.IsNullOrEmpty(txtNewPassword2.Text)) Page.ClientScript.RegisterStartupScript(this.GetType(), "Script", "<script> alert('All fields are required.Thank you!'); </script>"); if (canChangePass) { Salt salt = new Salt(); string password1 = txtNewPassword1.Text; string password2 = txtNewPassword2.Text; if (txtNewPassword1.Text == txtNewPassword2.Text) { customer customerObj = new customer(); string role = "customer"; int result = customerObj.ResetPassword(email, null, password1, salt.ToString(),role); if (result == 0) lblMsg.Text = "The password you entered is incorrect!"; else if (result == 1) lblMsg.Text = "The password was changed successfully."; } } else lblMsg.Text = "You do not have authorization to access this email address."; }