Ejemplo n.º 1
0
        private new void Update()
        {
            if (String.IsNullOrEmpty(txtOldPassword.Text))
            {
                MessageForm.Error(this, MsgE.ErrorEmptyOldPassword);
                return;
            }
            else if (UCrypto.Encrypt(txtOldPassword.Text) != Ap.CurrentUser.Password)
            {
                MessageForm.Error(this, MsgE.ErrorWrongOldPassword);
                return;
            }

            DataSet ds     = SocketClient.ChangePassword(txtPassword.Text, txtPasswordHint.Text);
            bool    update = false;

            if (ds != null && ds.Tables.Count > 0)
            {
                Kv kv = new Kv(ds.Tables[0]);
                update = kv.GetBool("Updated");
            }

            if (update)
            {
                MessageForm.Show(this, MsgE.InfoUpdatePassword);

                Ap.CurrentUser.Password     = UCrypto.Encrypt(txtPassword.Text);
                Ap.CurrentUser.PasswordHint = txtPasswordHint.Text;
            }
            else
            {
                MessageForm.Error(this, MsgE.ErrorUpdatePassword);
            }
            this.Close();
        }