//失去焦点时查询安全问题 private void textBox1_Leave(object sender, EventArgs e) { TXL_Safe mySafe = new TXL_Safe(); _userName = UserNameText.Text; mySafe.UserName = UserName; QuestionLable.Text = mySafe.GetQuestion(); }
//点击找回密码 private void FindPass_Click(object sender, EventArgs e) { TXL_Safe mySafe = new TXL_Safe(); _userName = UserNameText.Text; _question = QuestionLable.Text; _answer = AnswerText.Text; mySafe.UserName = UserName; mySafe.Question = Question; mySafe.Answer = Answer; if (mySafe.safe() == true) { MessageBox.Show("您的密码是 "+mySafe.Keys()+" 请牢记!"); this.Close(); } else { MessageBox.Show("回答错误!"); } }
//点击找回密码 private void FindPass_Click(object sender, EventArgs e) { TXL_Safe mySafe = new TXL_Safe(); _userName = UserNameText.Text; _question = QuestionLable.Text; _answer = AnswerText.Text; mySafe.UserName = UserName; mySafe.Question = Question; mySafe.Answer = Answer; if (mySafe.safe() == true) { MessageBox.Show("您的密码是 " + mySafe.Keys() + " 请牢记!"); this.Close(); } else { MessageBox.Show("回答错误!"); } }
//注册 private void SuerBtn_Click(object sender, EventArgs e) { if (UserNameText.Text.Length != 0 && PassText.Text.Length != 0 && QuestionText.Text.Length != 0 && PassText.Text.Length != 0) { _userName = UserNameText.Text; _pass = PassText.Text; _question = QuestionText.Text; _answer = AnswerText.Text; TXL_Users myUsers = new TXL_Users(); myUsers.UserName = UserName; myUsers.Pass = Pass; TXL_Safe mySafe = new TXL_Safe(); mySafe.UserName = UserName; mySafe.Question = Question; mySafe.Answer = Answer; if (myUsers.exit() == false) { myUsers.Add(); mySafe.Add(); MessageBox.Show("注册成功,您可你是用本软件了!"); //注册完成关闭此窗口 this.Close(); } else { MessageBox.Show("账号已存在!!"); } } else { MessageBox.Show("任何一项都不能为空请注意填写(ˇˍˇ)!"); } }