Web/ModifySelfPwd.aspx.cs

(完整代码) 1KB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Text;
using RhData;
using CityMgr;
using CityMgr.Base;

namespace WebApp
{
    public partial class ModifySelfPwd : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            AjaxPro.Utility.RegisterTypeForAjax(typeof(ModifySelfPwd));
            AjaxPro.Utility.RegisterTypeForAjax(typeof(LxAjaxEntityHelpper));
        }

        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="oldPwd">原密码</param>
        /// <param name="newPwd">新密码</param>
        [AjaxPro.AjaxMethod(AjaxPro.HttpSessionStateRequirement.Read)]
        public void ModifyPwd(string oldPwd, string newPwd)
        {
            var cxt = HttpContext.Current.Session["UserContext"] as LxUserContext;
            if (cxt == null)
                throw new LxBusException("请先登录");

            if (!cxt.User.Validate(LxFunction.MyMD5(oldPwd)))
                throw new LxBusException("原密码错误");

            if (!ValidateHelperr.RequireString(newPwd, 1))
                throw new LxBusException("密码不可为空");

            cxt.User.ModifyPwd(LxFunction.MyMD5(newPwd));
        }
    }
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。