Esempio n. 1
0
 public RegInfo_Person() { u = new 个人用户(); }
        public ActionResult PersonInfoManage(个人用户 per)
        {
            var step = Request.Form["step"];
            switch (step)
            {
                case "identity":
                    currentUser.个人信息 = per.个人信息;
                    break;
                case "attach":
                    if (!string.IsNullOrWhiteSpace(Request.Form["attachtext"]))
                    {
                        currentUser.登录信息.头像 = Request.Form["attachtext"];
                    }
                    break;
                case "contact":
                    currentUser.联系方式 = per.联系方式;
                    break;
                case "password":
                    var oldpwd = Request.Form["oldpwd"];
                    var newpwd = Request.Form["newpwd"];
                    var confirmpwd = Request.Form["confirmpwd"];

                    if (currentUser.登录信息.密码 != Hash.Compute(oldpwd.Trim()))
                    {
                        return Content("<script>alert('原密码错误!');window.location='/个人用户后台/MyBaseInfo'</script>");
                    }
                    else if (newpwd.Trim() != confirmpwd.Trim())
                    {
                        return Content("<script>alert('新密码两次输入不一致!');window.location='/个人用户后台/MyBaseInfo'</script>");
                    }
                    else
                    {
                        currentUser.登录信息.密码 = Hash.Compute(newpwd.Trim());
                    }
                    break;
            }

            
            用户管理.更新用户<个人用户>(currentUser);
            return Content("<script>alert('修改成功');window.location='/个人用户后台/MyBaseInfo'</script>");
        }