Esempio n. 1
0
        private void btSavePassword_Click(object sender, EventArgs e)
        {
            if (txtOldPass.Text == "")
            {
                MessageBox.Show("Password can not be empty");
            }
            else if (CheckValidPass(txtOldPass.Text) == false)
            {
                MessageBox.Show("Password can not have invalid character");
            }
            else if (CheckValidPass(txtNewPass.Text) == false)
            {
                MessageBox.Show("Password can not have invalid character");
            }
            else
            {
                string ePassword = ManageSystem.EncryptPassword(txtOldPass.Text);
                if (!ManageSystem.Pass(ePassword))
                {
                    MessageBox.Show("Old password is not correct", "Thông báo");
                }
                else if (txtNewPass.Text == "")
                {
                    MessageBox.Show("Password can not be empty");
                }
                else if (txtNewPass.Text != txtReNewPass.Text)
                {
                    MessageBox.Show("Re-Password is not correct");
                }
                else if (txtNewPass.Text == txtOldPass.Text)
                {
                    MessageBox.Show("The new password is the same as the old password");
                }
                else
                {
                    string TK = ManageSystem.TK();

                    ManageSystem.UpdateNewPassword(ManageSystem.GetUserID(TK), txtNewPass.Text);
                    ManageSystem.UpdateNewPasswordToDatabase(ManageSystem.GetUserID(TK), txtNewPass.Text);

                    string ePassword1 = ManageSystem.EncryptPassword(txtNewPass.Text);
                    ManageSystem.UpdatePass(ePassword1);
                    MessageBox.Show("Save success!");
                    pnlEdit.Visible            = false;
                    pnlEdit.Enabled            = false;
                    pnlPersonalDetails.Visible = true;
                    pnlPersonalDetails.Enabled = true;
                    pnlSavePass.Visible        = false;
                    pnlSavePass.Enabled        = false;

                    ClearTextbox();
                }
            }
        }
Esempio n. 2
0
 private void btnConfirm_Click(object sender, EventArgs e)
 {
     if (txtRePassForget.Text != txtPassForget.Text)
     {
         MessageBox.Show("Nhập lại mật khẩu không chính xác!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else if (txtValidateCode.Text != verifiedCode)
     {
         MessageBox.Show("Mã xác nhận không chính xác !", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else
     {
         ManageSystem.UpdateNewPassword(ManageSystem.GetUserID_Email(txtCheckEmail.Text), txtPassForget.Text);
         ManageSystem.UpdateNewPasswordToDatabase(ManageSystem.GetUserID_Email(txtCheckEmail.Text), txtPassForget.Text);
         MessageBox.Show("Done");
         pnlForgetPass.Visible = false;
         pnlUserLogin.Visible  = true;
         pnlSignup.Visible     = false;
         transitionPanel.HideSync(pnlSignup);
         this.AcceptButton = this.btnLogin;
         ClearTextBox();
     }
 }