Exemple #1
0
        public JsonResult SaveUpdatePwd(string oldPwd, string newPwd)
        {
            if (oldPwd != CurrentUser.Pwd)
            {
                return(Json(new { isSuccess = false, Msg = "旧密码错误!" }));
            }
            var user = UserInfoBz.Get(o => o.UserName == CurrentUser.UserName);

            user.Pwd = UserInfoBz.GetPwdAES(newPwd);
            bool isSuccess = UserInfoBz.Update(user);

            if (isSuccess)
            {
                SessionHelper.Del("CurUser");
                UserInfoBz.ClearAccountCookie();
            }
            return(Json(new { isSuccess = isSuccess, Msg = isSuccess ? "修改成功!" : "修改失败!" }));
        }
Exemple #2
0
        public ActionResult SaveUserConfig(UserInfo entity)
        {
            var userInfo = UserInfoBz.Get(o => o.ID == entity.ID);

            userInfo.UserName     = entity.UserName;
            userInfo.IsValid      = entity.IsValid;
            userInfo.IsSuperAdmin = entity.IsSuperAdmin;
            userInfo.HeadImgUrl   = entity.HeadImgUrl;
            userInfo.RoleID       = entity.RoleID;
            var isSuccess = UserInfoBz.Update(userInfo);

            if (isSuccess)
            {
                ViewBag.Msg = "保存成功!";
            }
            else
            {
                ViewBag.Msg = "保存失败!";
            }
            return(RedirectToAction("UserConfig", new { msg = ViewBag.Msg }));
        }