Exemplo n.º 1
0
        public JsonResult ChangePassword(ChangePasswordModel model)
        {
            string oldPassword    = model.OldPassword;
            string newPassword    = model.NewPassword;
            var    authorizeRelay = new AspNetIdentiyAuthorizeRelay <SysUser>(CurrentDb);
            bool   result         = authorizeRelay.ChangePassword(User.Identity.GetUserId <int>(), oldPassword, newPassword);

            if (!result)
            {
                return(Json(ResultType.Failure, ManagerOperateTipUtils.CHANGEPASSWORD_OLDPASSWORDINCORRECT));
            }



            if (Request.IsAuthenticated)
            {
                authorizeRelay.SignOut();
            }


            return(Json(ResultType.Success, "Please re sigin,click <a href=\"" + ManagerUtils.GetLoginPage() + "\">sigin</a>"));
        }
Exemplo n.º 2
0
        public JsonResult ChangePassword(ChangePasswordModel model)
        {
            string oldPassword    = model.OldPassword;
            string newPassword    = model.NewPassword;
            var    authorizeRelay = new AspNetIdentiyAuthorizeRelay <SysUser>();
            bool   result         = authorizeRelay.ChangePassword(this.CurrentUserId, this.CurrentUserId, oldPassword, newPassword);

            if (!result)
            {
                return(Json(ResultType.Failure, WebBackOperateTipUtils.CHANGEPASSWORD_OLDPASSWORDINCORRECT));
            }



            if (Request.IsAuthenticated)
            {
                authorizeRelay.SignOut();
            }


            return(Json(ResultType.Success, "点击<a href=\"" + WebBackConfig.GetLoginPage() + "\">登录</a>"));
        }