Ejemplo n.º 1
0
        private void ListPass_Load(object sender, EventArgs e)
        {
            this.comboBox = comboBox_key;

            string url           = XMLDealTool.getUrlPath() + "cloudkey/userinfolist.php";
            string data          = "username="******"&password="******"";

            JObject jo = JObject.Parse(result);

            //jo.Properties().Select(item => item.Value);
            string[] values = jo.Properties().Select(item => item.Value.ToString()).ToArray();
            foreach (string s in values)
            {
                jsonArrayText += s;
            }

            JArray ja = (JArray)JsonConvert.DeserializeObject(jsonArrayText);

            foreach (JObject jobj in ja)
            {
                Record record = new Record();
                record.title    = Encrypt.Base64ToString(jobj["title"].ToString());
                record.zhanghao = Encrypt.Base64ToString(jobj["zhanghao"].ToString());
                record.lable    = Encrypt.Base64ToString(jobj["lable"].ToString());
                record.num      = Int32.Parse(jobj["num"].ToString());

                comboBox.Items.Add(record.title);

                listRecord.Add(record);
            }
        }
Ejemplo n.º 2
0
        private void Btn_update_Click(object sender, EventArgs e)
        {
            string nmima  = text_nmima.Text;
            string cnmima = text_ncmima.Text;
            string lable  = Encrypt.StringToBase64string(text_lable.Text);;

            if (nmima.Equals(cnmima) && nmima != "")
            {
                string keypath = XMLDealTool.getKeyPath() + "\\" + this.record.title + ".png";
                string nkey    = KeyConvert.CreateKey(keypath);
                nmima = Encrypt.AESEncrypt(nmima, nkey);
                nmima = Encrypt.StringToBase64string(nmima);
                string url    = XMLDealTool.getUrlPath() + "cloudkey/update_pass.php";
                string data   = "username="******"&password="******"&key=" + nkey + "&num=" + this.record.num + "&mima=" + nmima + "&lable=" + lable;
                string result = HttpGet.HttpGet_test(url, data);
                if (result.IndexOf("ok") != -1)
                {
                    MessageBox.Show("修改成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    text_nmima.ResetText();
                    text_ncmima.ResetText();
                    text_lable.ResetText();
                }
                else
                {
                    MessageBox.Show("修改失败,请重新登录后再进行修改!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            else
            {
                MessageBox.Show("请检查输入的新密码!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Ejemplo n.º 3
0
        private void LookLog_Load(object sender, EventArgs e)
        {
            string url    = XMLDealTool.getUrlPath() + "cloudkey/getlog.php";
            string data   = "username="******"&password=" + password;
            string result = HttpGet.HttpGet_test(url, data);

            waterText.Text = result;
        }
Ejemplo n.º 4
0
        private void skinButton1_Click(object sender, EventArgs e)
        {
            string title    = text_title.Text;
            string zhanghao = text_zhanghao.Text;
            string mima     = text_mima.Text;
            string conmima  = text_conmima.Text;
            string lable    = text_lable.Text;



            if (mima.Equals(conmima) && title != "" && zhanghao != "" && mima != "")
            {
                string keypath = XMLDealTool.getKeyPath() + "\\" + title + ".png";
                string key     = KeyConvert.CreateKey(keypath);
                mima     = Encrypt.AESEncrypt(mima, key);
                mima     = Encrypt.StringToBase64string(mima);
                title    = Encrypt.StringToBase64string(title);
                zhanghao = Encrypt.StringToBase64string(zhanghao);
                lable    = Encrypt.StringToBase64string(lable);

                string url  = XMLDealTool.getUrlPath() + "cloudkey/addpass.php";
                string data = "username="******"&password="******"&title=" + title + "&zhanghao=" + zhanghao;
                data = data + "&key=" + key + "&mima=" + mima + "&lable=" + lable;
                string result = HttpGet.HttpGet_test(url, data);

                if (result.IndexOf("ok") != -1)
                {
                    MessageBox.Show("添加成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    text_title.ResetText();
                    text_zhanghao.ResetText();
                    text_mima.ResetText();
                    text_conmima.ResetText();
                    text_lable.ResetText();
                }
                else
                {
                    //添加失败删除key图片
                    File.Delete(keypath);
                    MessageBox.Show("添加失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("请输入完整的账号信息!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 5
0
        private void Btn_update_Click(object sender, EventArgs e)
        {
            string password = text_password.Text;
            string npass    = text_npass.Text;
            string cnpass   = text_cnpass.Text;

            Email email = new Email();

            email.mailFrom    = "发件地址";
            email.mailPwd     = "********";
            email.mailSubject = "提示:修改登陆密码";
            email.mailBody    = "您的登陆密码已修改为:" + npass + ",若非本人操作请立即锁定账号,以免造成不必要的损失。";
            email.isbodyHtml  = true;
            email.host        = "smtp.163.com";//根据情况自行更改

            password = Encrypt.StringToBase64string(password);
            npass    = Encrypt.StringToBase64string(npass);
            cnpass   = Encrypt.StringToBase64string(cnpass);

            if (this.password.Equals(password) && npass.Equals(cnpass))
            {
                string url    = XMLDealTool.getUrlPath() + "cloudkey/update_managepass.php";
                string data   = "username="******"&password="******"&newpass="******"error") == -1)
                {
                    MessageBox.Show("修改成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    email.mailTo = result;
                    email.Send();

                    this.Hide();
                    mainui.Show();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("修改失败,请注意输入!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
Ejemplo n.º 6
0
        private void text_mima_Enter(object sender, System.EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.InitialDirectory = XMLDealTool.getKeyPath();
            dlg.Filter           = "密钥文件|*.png";
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                key = KeyConvert.GetKeyByImage(dlg.FileName);

                string url    = XMLDealTool.getUrlPath() + "cloudkey/getpass.php";
                string data   = "username="******"&password="******"&key=" + key + "&num=" + this.record.num;
                string result = HttpGet.HttpGet_test(url, data);
                if (result.Equals("error"))
                {
                    MessageBox.Show("无效密钥!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                text_mima.Text = dlg.FileName;
            }
        }
Ejemplo n.º 7
0
        private void Btn_jiexi_Click(object sender, EventArgs e)
        {
            int            num  = selectedRecord.num;
            string         mima = "";
            OpenFileDialog dlg  = new OpenFileDialog();

            dlg.InitialDirectory = XMLDealTool.getKeyPath();
            dlg.Filter           = "密钥文件|*.png";
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                string key = KeyConvert.GetKeyByImage(dlg.FileName);


                string url    = XMLDealTool.getUrlPath() + "cloudkey/getpass.php";
                string data   = "username="******"&password="******"&key=" + key + "&num=" + num;
                string result = HttpGet.HttpGet_test(url, data);
                if (result.IndexOf("error") != -1)
                {
                    MessageBox.Show("解析失败,请检查密钥图片是否正确!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                //MessageBox.Show("您的账号密码是:" + result, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                result = Encrypt.Base64ToString(result);
                mima   = Encrypt.AESDecrypt(result, key);
                if (mima.IndexOf("error") != -1)
                {
                    MessageBox.Show("解析失败,请检查密钥图片是否正确!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            else
            {
                return;
            }
            MessageBox.Show("您的账号密码是:" + mima, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Ejemplo n.º 8
0
        private void skinButton_login_Click(object sender, EventArgs e)
        {
            string username = Encrypt.GetMd5Hash(Login_username.Text);
            string password = Login_password.Text;

            password = Encrypt.StringToBase64string(password);

            string url    = XMLDealTool.getUrlPath() + "cloudkey/login_check.php";
            string data   = "username="******"&password="******"ok") != -1)
            {
                MainUI mainui = new MainUI();
                this.Visible = false;
                mainui.setUserPass(username, password);
                mainui.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("密码错误", result, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 9
0
        private void skinButton_Register_Click(object sender, EventArgs e)
        {
            string username = Register_username.Text;
            string pass     = Register_pswd.Text;
            string passinfo = Register_pswdinfo.Text;
            string mail     = Register_email.Text;
            Regex  r        = new Regex("^\\s*([A-Za-z0-9_-]+(\\.\\w+)*@(\\w+\\.)+\\w{2,5})\\s*$");

            if (!r.IsMatch(mail))
            {
                MessageBox.Show("邮箱格式有误!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (username != "" && pass != "" && passinfo != "" && mail != "")
            {
                if (pass.Equals(passinfo))
                {
                    //创建Email对象
                    Email email = new Email();
                    email.mailFrom    = "发送地址";
                    email.mailPwd     = "*******";
                    email.mailSubject = "CloudKeys---安心的密码管家";
                    email.mailBody    = "请妥善保管您的账号与密码:" + username + "&" + pass;
                    email.isbodyHtml  = true;
                    email.host        = "smtp.163.com";//根据自己情况更改
                    email.mailTo      = mail;

                    string url = XMLDealTool.getUrlPath() + "cloudkey/signin.php";
                    username = Encrypt.GetMd5Hash(username);
                    pass     = Encrypt.StringToBase64string(pass);
                    string data   = "username="******"&password="******"&Email=" + mail;
                    string result = HttpGet.HttpGet_test(url, data);

                    if (result.IndexOf("Error") == -1)
                    {
                        if (email.Send())
                        {
                            MessageBox.Show("注册成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            System.Diagnostics.Process.Start("explorer.exe", XMLDealTool.getUrlPath() + "cloudkey/success.php");
                        }
                        this.Hide();
                        login.Show();
                        this.Dispose();
                    }
                    else
                    {
                        MessageBox.Show("注册失败!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MessageBox.Show("两次输入的密码不一致!", "ERROR",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("请填写完整信息!", "WARN",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);
            }
        }