Esempio n. 1
0
        public ActionResult Index(RePassword password)
        {
            var operator1 = (User)HttpContext.Session[Common.Constants.USER_KEY];
            var model     = operatorBll.GetOperatorbyId(operator1.SysOperator.ID);

            if (model.Password != Util.GetPassword(model.LoginName, password.OldPassword.Trim()))
            {
                TempData["resultMsgType"] = "error";
                TempData["resultMsg"]     = "旧密码不正确";
                return(View());
            }
            else
            {
                var result = operatorBll.AlterPassword(operator1.SysOperator.ID, Util.GetPassword(model.LoginName, password.NewPassword.Trim()));
                if (result > 0)
                {
                    TempData["resultMsgType"] = "success";
                    TempData["resultMsg"]     = "修改成功";
                    return(RedirectToAction("Index"));
                }
                else
                {
                    TempData["resultMsgType"] = "error";
                    TempData["resultMsg"]     = "修改失败";
                    return(View());
                }
            }
        }
Esempio n. 2
0
        public ActionResult ResetPassword(long opid, string newpwd)
        {
            var result        = new AjaxResult();
            var operatorModel = operatorBll.GetOperatorbyId(opid);

            if (operatorModel == null)
            {
                result.flag    = false;
                result.message = "未找到操作员信息";
                return(Json(result));
            }
            var user = Session[Constants.USER_KEY] as User;

            if (operatorBll.AlterPassword(opid, Util.GetPassword(operatorModel.LoginName, newpwd.Trim())) > 0)
            {
                result.flag = true;
                return(Json(result));
            }
            result.flag    = false;
            result.message = "重置密码失败";
            return(Json(result));
        }