Song.Site/Mobile/SelfPw.ashx.cs

(完整代码) 2KB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using WeiSha.Common;
using Song.ServiceInterfaces;
using VTemplate.Engine;
namespace Song.Site.Mobile
{
    /// <summary>
    /// 修改学员密码
    /// </summary>
    public class SelfPw : BasePage
    {
        //学员原密码,新密码
        protected string oldPw = WeiSha.Common.Request.Form["tbPw"].String;
        protected string newPw = WeiSha.Common.Request.Form["tbNewPw"].String;
        protected override void InitPageTemplate(HttpContext context)
        {
            if (!Extend.LoginState.Student.IsLogin)
                this.Response.Redirect("Entry.ashx");
            if (!string.IsNullOrWhiteSpace(oldPw))
            {
                Song.Entities.Student st = Extend.LoginState.Student.CurrentUser;
                //通过验证,进入登录状态            
                Song.Entities.Student emp = Business.Do<IStudent>().StudentSingle(st.St_AccName, oldPw, this.Organ.Org_ID);
                if (emp == null)
                {
                    //密码不正确
                    this.Response.Redirect(addPara(context.Request.Url.AbsolutePath, "error=3"));
                }
                else
                {
                    st.St_Pw = newPw;
                    Business.Do<IStudent>().StudentSave(st);
                    this.Response.Redirect("SelfInfo.ashx");
                }  
            }
        }
        /// <summary>
        /// 增加地址的参数
        /// </summary>
        /// <param name="url"></param>
        /// <param name="para"></param>
        /// <returns></returns>
        private string addPara(string url, params string[] para)
        {
            string p = "";
            for (int i = 0; i < para.Length; i++)
            {
                p += para[i];
                if (i < para.Length - 1) p += "&";
            }
            url += (url.IndexOf("?") > -1 ? "&" : "?") + p;
            return url;
        }
    }
}

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

AI 解读

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

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