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();
        }
示例#2
0
        private static string ReplaceTokens(Cxt cxt, string s, User user)
        {
            s = s.Replace("%username%", user.UserName);
            s = s.Replace("%password%", UCrypto.Decrypt(user.Password));
            s = s.Replace("%name%", user.FirstName + " " + user.LastName);
            //s = s.Replace("%signinlink%", KeyValues.Instance.GetKeyValue(KeyValueE.UrlInfiChess).Value);
            KeyValue keyValue = new KeyValue(cxt, (int)KeyValueE.UrlInfiChess);

            s = s.Replace("%signinlink%", keyValue.Value);
            return(s);
        }
        public static string ReadToEnd2(string path)
        {
            string encryptedValue = string.Empty;

            encryptedValue = File.ReadAllText(path);

            string decryptedValue = string.Empty;

            decryptedValue = UCrypto.Decrypt(encryptedValue);

            return(decryptedValue);
        }
        private void Save()
        {
            UserKv.Password     = UCrypto.Encrypt(txtPassword.Text);
            UserKv.PasswordHint = txtPasswordHint.Text;

            DataSet ds = SocketClient.AddUser(UserKv);

            if (ds != null && ds.Tables.Count > 0)
            {
                Kv kv = new Kv(ds.Tables[0]);
                Srv.SetCurrentUser(kv);
                SocketClient.LoginUser(Ap.CurrentUserID, UserStatusE.Blank);
                this.Visible = false;
                ApWin.StartupForm.Visible = false;
                OnlineClient frm = new OnlineClient();
                frm.Show();
            }
            this.Close();
        }