Example #1
0
        private void btnNewPass_Click(object sender, EventArgs e)
        {
            if (txtCNP.Text.Equals(txtNPW.Text))
            {
                if (_controller.Authenticate(User.GetInstance().username, txtOPW.Text) == 0)
                {
                    bool didSucceed = _controller.UserPasswordUpdate(txtNPW.Text);

                    if (didSucceed)
                    {
                        btnSave.Enabled = false;

                        MessageBox.Show("You've successfully changed Your password.", "Password Changed", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        chkPW.Checked = false;
                        txtOPW.Text   = "";
                        txtNPW.Text   = "";
                        txtCNP.Text   = "";
                    }
                    else
                    {
                        MessageBox.Show("Password could not be changed", "Password Change Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
        }