コード例 #1
0
ファイル: RegisterAct.java プロジェクト: bgarrels/cxldemo
 @RequestMapping(value = "/email_unique.jspx")
 public void emailUnique(HttpServletRequest request, HttpServletResponse response) {
   String email = RequestUtils.getQueryParam(request, "email");
   // email为空,返回false。
   if (StringUtils.isBlank(email)) {
     ResponseUtils.renderJson(response, "false");
     return;
   }
   // email存在,返回false。
   if (unifiedUserMng.emailExist(email)) {
     ResponseUtils.renderJson(response, "false");
     return;
   }
   ResponseUtils.renderJson(response, "true");
 }
コード例 #2
0
 @RequestMapping(value = "/username_unique.jspx")
 public void usernameUnique(HttpServletRequest request, HttpServletResponse response) {
   String username = RequestUtils.getQueryParam(request, "username");
   // 用户名为空,返回false。
   if (StringUtils.isBlank(username)) {
     ResponseUtils.renderJson(response, "false");
     return;
   }
   // 用户名存在,返回false。
   if (unifiedUserMng.usernameExist(username)) {
     ResponseUtils.renderJson(response, "false");
     return;
   }
   ResponseUtils.renderJson(response, "true");
 }
コード例 #3
0
ファイル: DataAct.java プロジェクト: Chenghongchao/jeecms
 @RequestMapping("/data/o_backup_progress.do")
 public void getBackupProgress(HttpServletRequest request, HttpServletResponse response)
     throws JSONException {
   JSONObject json = new JSONObject();
   json.put("tablename", backup_table);
   ResponseUtils.renderJson(response, json.toString());
 }
コード例 #4
0
ファイル: DimensionCodeAct.java プロジェクト: JDFISH/daily
  @RequiresPermissions("special:o_create_dimensioncode")
  @RequestMapping("/special/o_create_dimensioncode.do")
  public void createCodeImg(
      String content,
      String logoPicPath,
      String logoWord,
      Integer fontSize,
      Integer size,
      HttpServletRequest request,
      HttpServletResponse response) {
    JSONObject json = new JSONObject();
    if (StringUtils.isNotBlank(content)) {
      CmsSite site = CmsUtils.getSite(request);
      if (size == null) {
        size = 100;
      }
      if (fontSize == null) {
        fontSize = 10;
      }
      String logoPic = null;
      if (StringUtils.isNotBlank(logoPicPath)) {
        if (StringUtils.isNotBlank(site.getContextPath())
            && logoPicPath.startsWith(site.getContextPath())) {
          logoPicPath = logoPicPath.substring(site.getContextPath().length());
        }
        logoPic = realPathResolver.get(logoPicPath);
      }
      response.setContentType("image/png; charset=utf-8");
      try {

        ZXingCode zp = ZXingCode.getInstance();

        BufferedImage bim =
            zp.getQRCODEBufferedImage(
                content, BarcodeFormat.QR_CODE, size, size, zp.getDecodeHintType());
        if (StringUtils.isNotBlank(logoPicPath)) {
          zp.addLogoQRCode(bim, new File(logoPic), new ZxingLogoConfig());
        } else if (StringUtils.isNotBlank(logoWord)) {
          zp.addLogoWordQRCode(bim, logoWord, fontSize, new ZxingLogoConfig());
        }
        String tempFileName = DEMENSION_CODE_IMG_NAME;
        File file = new File(realPathResolver.get(tempFileName));
        ImageIO.write(bim, "png", file);
        if (StringUtils.isNotBlank(site.getContextPath())) {
          tempFileName = site.getContextPath() + tempFileName;
        }
        json.put("url", tempFileName);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
    ResponseUtils.renderJson(response, json.toString());
  }
コード例 #5
0
ファイル: RegisterAct.java プロジェクト: bgarrels/cxldemo
 @RequestMapping(value = "/username_unique.jspx")
 public void usernameUnique(HttpServletRequest request, HttpServletResponse response) {
   String username = RequestUtils.getQueryParam(request, "username");
   // 用户名为空,返回false。
   if (StringUtils.isBlank(username)) {
     ResponseUtils.renderJson(response, "false");
     return;
   }
   CmsSite site = CmsUtils.getSite(request);
   CmsConfig config = site.getConfig();
   // 保留字检查不通过,返回false。
   if (!config.getMemberConfig().checkUsernameReserved(username)) {
     ResponseUtils.renderJson(response, "false");
     return;
   }
   // 用户名存在,返回false。
   if (unifiedUserMng.usernameExist(username)) {
     ResponseUtils.renderJson(response, "false");
     return;
   }
   ResponseUtils.renderJson(response, "true");
 }
コード例 #6
0
 @RequestMapping(value = "/group/v_tree.do")
 public String tree(
     String root,
     Integer groupId,
     HttpServletRequest request,
     HttpServletResponse response,
     ModelMap model) {
   log.debug("tree path={}", root);
   boolean isRoot;
   // jquery treeview的根请求为root=source
   if (StringUtils.isBlank(root) || "source".equals(root)) {
     isRoot = true;
   } else {
     isRoot = false;
   }
   model.addAttribute("isRoot", isRoot);
   WebErrors errors = validateTree(root, request);
   if (errors.hasErrors()) {
     log.error(errors.getErrors().get(0));
     ResponseUtils.renderJson(response, "[]");
     return null;
   }
   CmsSite site = CmsUtils.getSite(request);
   BbsUserGroup group = manager.findById(groupId);
   Integer[] postTypeIds = group.fetchIds(group.getPostTypes());
   if (isRoot) {
     List<BbsForum> list;
     list = bbsForumMng.getList(site.getId());
     model.addAttribute("list", list);
   } else {
     List<BbsPostType> list;
     Integer parentId;
     if (StringUtils.isNotBlank(root) && root.contains(",")) {
       parentId = Integer.valueOf(root.split(",")[0]);
       list = bbsPostTypeMng.getList(site.getId(), null, parentId);
     } else {
       parentId = Integer.valueOf(root);
       list = bbsPostTypeMng.getList(site.getId(), parentId, null);
     }
     model.addAttribute("list", list);
   }
   model.put("postTypeIds", postTypeIds);
   response.setHeader("Cache-Control", "no-cache");
   response.setContentType("text/json;charset=UTF-8");
   return "group/tree";
 }
コード例 #7
0
ファイル: MemberAct.java プロジェクト: muyutingfeng/jeecms
 /**
  * 验证密码是否正确
  *
  * @param origPwd 原密码
  * @param request
  * @param response
  */
 @RequestMapping("/member/checkPwd.jspx")
 public void checkPwd(String origPwd, HttpServletRequest request, HttpServletResponse response) {
   CmsUser user = CmsUtils.getUser(request);
   boolean pass = cmsUserMng.isPasswordValid(user.getId(), origPwd);
   ResponseUtils.renderJson(response, pass ? "true" : "false");
 }