Ejemplo n.º 1
0
        protected void PasswordSaveButton_Click(object sender, EventArgs e)
        {
            long userid = Convert.ToInt64(Session["EditUserID"]);
            string newpassword = NewPasswordTextBox.Text;
            string confirmpassword = ConfirmPasswordTextBox.Text;

            UserBL userBL = new UserBL();

                if (newpassword.Length >= 6)
                {
                    if (newpassword == confirmpassword)
                    {
                        // save password
                        ErrorLabel.Text = "Success and Saved!";
                        userBL.SetUserPassword(newpassword,userid);

                        TextBox pe = (TextBox)UsersDetailsView.FindControl("PasswordTextBox");
                        pe.Text = newpassword;
                        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "script", "CloseModal('BodyContent_ModalPanel1');", true);

                    }
                    else
                    {
                        // new and confirm did not match
                        ErrorLabel.Text = "Confirm Password did not match! Please try again";
                    }

                }
                else
                {
                    // more than 6 char
                    ErrorLabel.Text = "Password length should be more than 5 characters";
                }
        }