Example #1
0
        private async void button2_Click(object sender, EventArgs e)
        {
            if (context != null)
            {
                context.Dispose();
            }
            context = new DockerUserControllerEntities();
            bool result = await context.EditSet.AllAsync(m => m.Email == textBox2.Text);

            if (result)
            {
                MessageBox.Show("该邮箱已经被注册过", "Error", MessageBoxButtons.OK);
                return;
            }
            string[] list = cookiemsg.Split('^');
            string   user = list[1];

            if (textBox2.Text == "")
            {
                MessageBox.Show("不能为空", "Error", MessageBoxButtons.OK);
                return;
            }
            int  code   = GetCode(6);
            bool sended = EmailSender.SendEmail(textBox2.Text.ToString(), "验证码", "验证码是:" + code.ToString());

            if (sended)
            {
                ConformEmail ce = new ConformEmail(code, user, textBox2.Text.ToString(), false);
                ce.ShowDialog();
            }
            else
            {
                MessageBox.Show("未能发送邮件", "Error", MessageBoxButtons.OK);
                return;
            }
            Flaush();
            if (context != null)
            {
                context.Dispose();
            }
        }
Example #2
0
        private async void button3_Click(object sender, EventArgs e)
        {
            string[] list = cookiemsg.Split('^');
            string   user = list[1];

            if (textBox3.Text == "")
            {
                MessageBox.Show("手机号码不能为空", "Error", MessageBoxButtons.OK);
                return;
            }
            int code = GetCode(6);
            await SMSSender.SendSMS(textBox3.Text, "验证码:" + code.ToString(), "Code");

            ConformEmail ce = new ConformEmail(code, user, textBox3.Text.ToString(), true);

            ce.ShowDialog();
            Flaush();
            if (context != null)
            {
                context.Dispose();
            }
        }