pwdedit.aspx.cs
来自「基于Asp.net、MS sql sever 2000、C# 论坛系统源码」· CS 代码 · 共 79 行
CS
79 行
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 Stella.Utility;
using System.Security.Permissions;
namespace Stella.Web.Pages
{
/// <summary>
/// pwdEdit 的摘要说明。
/// </summary>
public class pwdEdit : Container
{
protected System.Web.UI.WebControls.TextBox pwd2;
protected System.Web.UI.WebControls.TextBox pwd1;
protected System.Web.UI.WebControls.Button go;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator2;
protected System.Web.UI.WebControls.CompareValidator CompareValidator1;
protected System.Web.UI.WebControls.Panel pwdPan;
protected System.Web.UI.WebControls.TextBox pwd0;
protected Stella.Web.Controls.LoginError err;
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.go.Click += new System.EventHandler(this.go_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
[PrincipalPermission(SecurityAction.Demand,Authenticated=true)]
private void go_Click(object sender, System.EventArgs e)
{
if(Session["user"]==null)
Response.Redirect("login.aspx");
Stella.Model.Member m2=(Stella.Model.Member)Session["user"];
Byte[] oldPwd=SecurityHelper.EncryptPassword(pwd0.Text,SecurityHelper.GetSalt(m2.Pwd));
if(SecurityHelper.CompareByteArray(oldPwd,m2.Pwd))
{
m2.Pwd=SecurityHelper.EncryptPassword(pwd1.Text);
this.userLogic.UpdatePassWord(m2);
Response.Redirect("index.aspx");
}
else
{
pwdPan.Visible=false;
err.Visible=true;
err.Message="有错误发生!造成该错误的原因可能是输入了错误的原密码。";
}
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?