示例#1
0
 /** 查看评论回复 */
 @RequestMapping(value = "/member/comment_replay.jspx")
 public String guestbook_replay(
     Integer id,
     String nextUrl,
     HttpServletRequest request,
     HttpServletResponse response,
     ModelMap model) {
   CmsSite site = CmsUtils.getSite(request);
   CmsUser user = CmsUtils.getUser(request);
   FrontUtils.frontData(request, model, site);
   MemberConfig mcfg = site.getConfig().getMemberConfig();
   // 没有开启会员功能
   if (!mcfg.isMemberOn()) {
     return FrontUtils.showMessage(request, model, "member.memberClose");
   }
   if (user == null) {
     return FrontUtils.showLogin(request, model, site);
   }
   CmsComment comment = commentMng.findById(id);
   if (!comment.getCommentUser().equals(user)) {
     WebErrors errors = WebErrors.create(request);
     errors.addErrorCode("error.noPermissionsView");
     return FrontUtils.showError(request, response, model, errors);
   }
   model.addAttribute("comment", comment);
   return FrontUtils.getTplPath(request, site.getSolutionPath(), TPLDIR_COMMENT, COMMENT_REPLY);
 }
示例#2
0
 /**
  * 我的评论
  *
  * <p>如果没有登录则跳转到登陆页
  *
  * @param request
  * @param response
  * @param model
  * @return
  */
 @RequestMapping(value = "/member/mycomments.jspx")
 public String mycomments(
     Integer pageNo, HttpServletRequest request, HttpServletResponse response, ModelMap model) {
   CmsSite site = CmsUtils.getSite(request);
   CmsUser user = CmsUtils.getUser(request);
   FrontUtils.frontData(request, model, site);
   MemberConfig mcfg = site.getConfig().getMemberConfig();
   // 没有开启会员功能
   if (!mcfg.isMemberOn()) {
     return FrontUtils.showMessage(request, model, "member.memberClose");
   }
   if (user == null) {
     return FrontUtils.showLogin(request, model, site);
   }
   Pagination pagination =
       commentMng.getPageForMember(
           site.getId(),
           null,
           user.getId(),
           null,
           null,
           null,
           null,
           true,
           cpn(pageNo),
           CookieUtils.getPageSize(request));
   model.addAttribute("pagination", pagination);
   return FrontUtils.getTplPath(request, site.getSolutionPath(), TPLDIR_COMMENT, COMMENT_LIST);
 }
示例#3
0
 @RequestMapping(value = "/public_auth.jspx")
 public String auth(
     String openId, HttpServletRequest request, HttpServletResponse response, ModelMap model) {
   CmsSite site = CmsUtils.getSite(request);
   FrontUtils.frontData(request, model, site);
   return FrontUtils.getTplPath(request, site.getSolutionPath(), TPLDIR_MEMBER, TPL_AUTH);
 }
示例#4
0
 /**
  * 客户端包含
  *
  * @param request
  * @param model
  * @return
  */
 @RequestMapping(value = "/login_csi.jspx")
 public String csi(HttpServletRequest request, ModelMap model) {
   CmsSite site = CmsUtils.getSite(request);
   // 将request中所有参数
   model.putAll(RequestUtils.getQueryParams(request));
   FrontUtils.frontData(request, model, site);
   return FrontUtils.getTplPath(request, site.getSolutionPath(), TPLDIR_CSI, LOGIN_CSI);
 }
示例#5
0
 @RequestMapping(value = "/public_bind_username.jspx")
 public String bind_username_post(
     String username, HttpServletRequest request, HttpServletResponse response, ModelMap model) {
   CmsSite site = CmsUtils.getSite(request);
   WebErrors errors = WebErrors.create(request);
   String source = "";
   if (StringUtils.isBlank(username)) {
     // 用户名为空
     errors.addErrorCode("error.usernameRequired");
   } else {
     boolean usernameExist = unifiedUserMng.usernameExist(username);
     if (usernameExist) {
       // 用户名存在
       errors.addErrorCode("error.usernameExist");
     } else {
       // 获取用户来源
       String openId = (String) session.getAttribute(request, CmsThirdAccount.QQ_KEY);
       String uid = (String) session.getAttribute(request, CmsThirdAccount.SINA_KEY);
       String weboOpenId = (String) session.getAttribute(request, CmsThirdAccount.QQ_WEBO_KEY);
       // (获取到登录授权key后可以注册用户)
       if (StringUtils.isNotBlank(openId)
           || StringUtils.isNotBlank(uid)
           || StringUtils.isNotBlank(weboOpenId)) {
         // 初始设置密码同用户名
         cmsUserMng.registerMember(
             username,
             null,
             username,
             RequestUtils.getIpAddr(request),
             null,
             null,
             false,
             new CmsUserExt(),
             null);
       }
       if (StringUtils.isNotBlank(openId)) {
         source = CmsThirdAccount.QQ_PLAT;
       } else if (StringUtils.isNotBlank(uid)) {
         source = CmsThirdAccount.SINA_PLAT;
       } else if (StringUtils.isNotBlank(weboOpenId)) {
         source = CmsThirdAccount.QQ_WEBO_PLAT;
       }
       // 提交登录并绑定账号
       loginByUsername(username, request, response, model);
     }
   }
   if (errors.hasErrors()) {
     errors.toModel(model);
     model.addAttribute("success", false);
   } else {
     model.addAttribute("success", true);
   }
   model.addAttribute("source", source);
   FrontUtils.frontData(request, model, site);
   return FrontUtils.getTplPath(request, site.getSolutionPath(), TPLDIR_MEMBER, TPL_BIND);
 }
示例#6
0
 @RequestMapping(value = "/public_bind.jspx", method = RequestMethod.POST)
 public String bind_post(
     String username,
     String password,
     HttpServletRequest request,
     HttpServletResponse response,
     ModelMap model) {
   boolean usernameExist = unifiedUserMng.usernameExist(username);
   CmsSite site = CmsUtils.getSite(request);
   WebErrors errors = WebErrors.create(request);
   String source = "";
   if (!usernameExist) {
     // 用户名不存在
     errors.addErrorCode("error.usernameNotExist");
   } else {
     UnifiedUser u = unifiedUserMng.getByUsername(username);
     boolean passwordValid = unifiedUserMng.isPasswordValid(u.getId(), password);
     if (!passwordValid) {
       errors.addErrorCode("error.passwordInvalid");
     } else {
       // 获取用户来源
       String openId = (String) session.getAttribute(request, CmsThirdAccount.QQ_KEY);
       String uid = (String) session.getAttribute(request, CmsThirdAccount.SINA_KEY);
       String weboOpenId = (String) session.getAttribute(request, CmsThirdAccount.QQ_WEBO_KEY);
       if (StringUtils.isNotBlank(openId)) {
         source = CmsThirdAccount.QQ_PLAT;
       } else if (StringUtils.isNotBlank(uid)) {
         source = CmsThirdAccount.SINA_PLAT;
       } else if (StringUtils.isNotBlank(weboOpenId)) {
         source = CmsThirdAccount.QQ_WEBO_PLAT;
       }
       // 提交登录并绑定账号
       loginByUsername(username, request, response, model);
     }
   }
   if (errors.hasErrors()) {
     errors.toModel(model);
     model.addAttribute("success", false);
   } else {
     model.addAttribute("success", true);
   }
   model.addAttribute("source", source);
   FrontUtils.frontData(request, model, site);
   return FrontUtils.getTplPath(request, site.getSolutionPath(), TPLDIR_MEMBER, TPL_BIND);
 }
示例#7
0
 @RequestMapping(value = "/public_bind.jspx", method = RequestMethod.GET)
 public String bind_get(HttpServletRequest request, HttpServletResponse response, ModelMap model) {
   CmsSite site = CmsUtils.getSite(request);
   FrontUtils.frontData(request, model, site);
   return FrontUtils.getTplPath(request, site.getSolutionPath(), TPLDIR_MEMBER, TPL_BIND);
 }