Example #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));
            }
        }
Example #2
0
        public IActionResult LoginInfo()
        {
            // 权限和菜单
            IndexModel model       = new IndexModel();
            var        layoutModel = this.GetLayoutModel();

            if (layoutModel != null)
            {
                layoutModel.ToT(ref model);
            }

            var admin = CMSAdminBO.GetAdminByUserName(model.UserName);

            if (admin != null && !string.IsNullOrEmpty(admin.UserName))
            {
                model.LastLogonIP   = admin.LastLogonIP;
                model.LastLogonTime = DateTimeUtils.UnixTimeStampToDateTime(admin.LastLogonTime);
            }
            else
            {
                model.LastLogonIP   = "本机IP";
                model.LastLogonTime = DateTime.Now;
            }

            return(View("./Index", model));
        }