Beispiel #1
0
        /// <summary>
        /// 密码修改
        /// </summary>
        /// <returns></returns>
        private string AlterPwd()
        {
            string before = Request.Form.Get("pwd_before");
            string news   = Request.Form.Get("pwd_news");
            string newsto = Request.Form.Get("pwd_newsTo");

            //验证旧密码
            if (before == null || string.IsNullOrEmpty(before))
            {
                return(ReturnString.JsonToString(Prompt.error, "旧密码不能为空", "pwd_before"));
            }
            if (!Regex.IsMatch(before, @"^(\w){6,20}$"))
            {
                return(ReturnString.JsonToString(Prompt.error, "旧密码输入不正确", "pwd_before"));
            }
            //验证新密码
            if (news == null || string.IsNullOrEmpty(news))
            {
                return(ReturnString.JsonToString(Prompt.error, "新密码不能为空", "pwd_news"));
            }
            if (!Regex.IsMatch(news, @"^(\w){6,20}$"))
            {
                return(ReturnString.JsonToString(Prompt.error, "新密码输入不正确", "pwd_news"));
            }
            //验证新密码与旧密码相同
            if (!news.Equals(newsto))
            {
                return(ReturnString.JsonToString(Prompt.error, "新密码与确认密码不一致!", "pwd_newsTo"));
            }
            //判断新密码与旧密码是否相同
            if (before.Equals(news))
            {
                return(ReturnString.JsonToString(Prompt.error, "旧密码与新密码相同无须修改!", "pwd_news"));
            }

            EDRS.BLL.XT_ZZJG_RYBM bll = new EDRS.BLL.XT_ZZJG_RYBM(this.Request);
            string msg = string.Empty;
            List <EDRS.Model.XT_QX_JSBM> jsbmList;

            EDRS.Model.XT_ZZJG_RYBM rybm = bll.UserLogin(UserInfo.DWBM, UserInfo.DLBM, before, out jsbmList, out msg);
            if (rybm != null)
            {
                rybm.KL = MD5Encrypt.Encrypt(news).ToLower();
                if (bll.Update(rybm))
                {
                    return(ReturnString.JsonToString(Prompt.win, "密码修改成功,重新登录生效!", null));
                }
                return(ReturnString.JsonToString(Prompt.error, "密码修改失败!", null));
            }
            else
            {
                return(ReturnString.JsonToString(Prompt.error, msg, null));
            }
        }
Beispiel #2
0
        public static string Edit(string data)
        {
            var editmodel = JsonHelper.ParseFormJson <EDRS.Model.XT_ZZJG_RYBM>(data);

            try
            {
                var bll = new EDRS.BLL.XT_ZZJG_RYBM(request);
                bll.Update(editmodel);

                return(ReturnString.JsonToString(Prompt.win, "修改成功", null));
            }
            catch (Exception)
            {
                return(ReturnString.JsonToString(Prompt.win, "修改失败", null));
            }
        }