Ejemplo n.º 1
0
        public IActionResult UpdatePassword()
        {
            //展示页面
            if (!Request.Method.ToUpper().Equals("POST", StringComparison.OrdinalIgnoreCase) || !Request.HasFormContentType)
            {
                // 权限和菜单
                UpdatePasswordModel model = new UpdatePasswordModel();
                var layoutModel           = this.GetLayoutModel();
                if (layoutModel != null)
                {
                    layoutModel.ToT(ref model);
                }

                return(View(model));
            }
            else
            {
                //修改密码
                var msg = new Message(10, "修改密码失败!");

                string oldPassword = Request.Form["oldPassword"];
                string password    = Request.Form["password"];
                string rePassword  = Request.Form["rePassword"];

                var adminToken = CMSAdminCookie.GetAdiminCookie();
                var admin      = CMSAdminBO.GetAdminByUserName(adminToken.UserName);
                if (admin != null || admin.ID > 0)
                {
                    msg = CMSAdminBO.UpdatePasswordByID(admin.ID, oldPassword, password, rePassword);
                }

                return(new JsonResult(msg));
            }
        }