88 lines
3.1 KiB
C#
88 lines
3.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Text.RegularExpressions;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
using UI.Framework.Forms;
|
|
|
|
namespace Grant.Framework
|
|
{
|
|
public partial class SetPassword : BaseForm
|
|
{
|
|
public SetPassword()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void SetPassword_Load(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
string kName = Guid.NewGuid().ToString();
|
|
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if(this.textBox2.Text != this.textBox3.Text) throw new Exception("两次密码输入不一致,请检查!");
|
|
if (this.textBox2.Text.Length < 6) throw new Exception("密码过于简单,请重新输入!");
|
|
var webResult = GrantClient.Get().SendPack("forgetPass", new { kName = kName, username = this.textBox1.Text, phone = this.textBox4.Text, code = "", userpass = this.textBox2.Text });
|
|
MessageBox.Show(webResult.message.ToString(), "友情提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
linkLabel1.Enabled = false;
|
|
linkLabel1.Text = "获取验证码" + "(" + 299 + ")";
|
|
this.timer1.Start();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
}
|
|
}
|
|
|
|
private void textBox5_TextChanged(object sender, EventArgs e)
|
|
{
|
|
if (this.textBox5.Text.Trim().Length == 4)
|
|
{
|
|
try
|
|
{
|
|
var webResult = GrantClient.Get().SendPack("forgetPass", new { kName = kName, username = this.textBox1.Text, phone = this.textBox4.Text, code = this.textBox5.Text, userpass = this.textBox2.Text });
|
|
MessageBox.Show(webResult.message.ToString(), "友情提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
this.Close();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
this.textBox5.Clear();
|
|
MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
}
|
|
}
|
|
}
|
|
|
|
private void timer1_Tick(object sender, EventArgs e)
|
|
{
|
|
var reg = Regex.Match(linkLabel1.Text, @"获取验证码\((\d+)\)");
|
|
if (reg.Success)
|
|
{
|
|
int number = int.Parse(reg.Groups[1].Value) - 1;
|
|
if (number <= 0)
|
|
{
|
|
linkLabel1.Text = "获取验证码";
|
|
linkLabel1.Enabled = true;
|
|
}
|
|
else
|
|
{
|
|
linkLabel1.Text = "获取验证码" + "(" + number + ")";
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
private void SetPassword_FormClosing(object sender, FormClosingEventArgs e)
|
|
{
|
|
this.timer1.Stop();
|
|
}
|
|
}
|
|
}
|