Пример #1
0
        public ActionResult ChangePassword(string oldpwd, string newpwd)
        {
            try
            {
                if (oldpwd.IsNullOrEmpty() || newpwd.IsNullOrEmpty())
                {
                    return(Json(new { status = 1, msg = "参数不能为空" }, JsonRequestBehavior.AllowGet));
                }

                oldpwd = RsaCryption.Decrypt(PublicConst.XmlPrivateKey, oldpwd);
                newpwd = RsaCryption.Decrypt(PublicConst.XmlPrivateKey, newpwd);

                if (oldpwd == newpwd)
                {
                    return(Json(new { status = 2, msg = "修改密码和原密码相同" }, JsonRequestBehavior.AllowGet));
                }

                var response = _iuserinfoservice.ChangePassword(new ChangePasswordRequest
                {
                    UserId      = LoginAccount.UserInfo.Id,
                    OldPassword = oldpwd,
                    NewPassword = newpwd
                });

                if (!response.IsSuccess)
                {
                    return(Json(new { status = 1, msg = response.MessageText }, JsonRequestBehavior.AllowGet));
                }

                return(Json(new { status = 0 }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                LogManager.DefaultLogger.ErrorFormat("修改用户密码出错{0}", new { oldpwd, newpwd, err = ex.ToString() }.ToJson());
                return(Json(new { status = -1, msg = "系统出错!" }, JsonRequestBehavior.AllowGet));
            }
        }
Пример #2
0
        public ActionResult ChangePassword(string oldpwd, string newpwd)
        {
            try
            {
                var response = _iuserinfoservice.ChangePassword(new ChangePasswordRequest
                {
                    UserId      = LoginAccount.UserInfo.Id,
                    OldPassword = oldpwd,
                    NewPassword = newpwd
                });

                if (!response.IsSuccess)
                {
                    return(Json(new { status = 1, msg = response.MessageText }, JsonRequestBehavior.AllowGet));
                }

                return(Json(new { status = 0 }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                LogManager.DefaultLogger.ErrorFormat("修改用户密码出错{0}", new { oldpwd, newpwd, err = ex.ToString() }.ToJson());
                return(Json(new { status = -1, msg = "系统出错!" }, JsonRequestBehavior.AllowGet));
            }
        }