📄 findpws.aspx.cs
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Club.Framework;
using Club.Framework.Components;
using Club.Framework.Configuration;
using Club.Framework.Data;
namespace Club
{
/// <summary>
/// findPws 的摘要说明。
/// </summary>
public class findPws : System.Web.UI.Page
{
protected System.Web.UI.WebControls.TextBox txtUsername;
protected System.Web.UI.WebControls.TextBox txtEmail;
protected System.Web.UI.WebControls.Button btnFind;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.btnFind.Click += new System.EventHandler(this.btnFind_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void btnFind_Click(object sender, System.EventArgs e)
{
c_UserInfo _user=Globals.DbProvider.Select_c_UserByUsername(this.txtUsername.Text.Trim());
if(_user==null)
{
throw new ShowException("用户名不正确!",true);
}
if(_user.Email.ToUpper()!=this.txtEmail.Text.Trim().ToUpper())
{
throw new ShowException("邮箱地址不正确!",true);
}
if(sendMail(_user))
{
throw new ShowException("密码邮件发送成功,请登录您的邮箱收取密码!",true);
}
else
{
throw new ShowException("密码邮件发送失败,请与管理员联系!",true);
}
}
private bool sendMail(c_UserInfo user)
{
string subjec="嘟嘟狗网上家园(Dooogo.com)找回密码";
string body="用户名:"+user.Username+"\n";
body+="密码:"+MySecurity.SDecryptString(user.Password)+"\n";
body+="请妥善保管您的用户名和密码。\n";
body+="如有什么问题:请登陆http://www.dooogo.com咨询。";
return Globals.SystemMail.Send(user.Email,Globals.SystemMail.UserName,subjec,body);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -