Пример #1
0
 /**
  * 密码修改提交页
  *
  * @param origPwd 原始密码
  * @param newPwd 新密码
  * @param email 邮箱
  * @param nextUrl 下一个页面地址
  * @param request
  * @param response
  * @param model
  * @return
  * @throws IOException
  */
 @RequestMapping(value = "/member/pwd.jspx", method = RequestMethod.POST)
 public String passwordSubmit(
     String origPwd,
     String newPwd,
     String email,
     String nextUrl,
     HttpServletRequest request,
     HttpServletResponse response,
     ModelMap model)
     throws IOException {
   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);
   }
   WebErrors errors = validatePasswordSubmit(user.getId(), origPwd, newPwd, email, request);
   if (errors.hasErrors()) {
     return FrontUtils.showError(request, response, model, errors);
   }
   cmsUserMng.updatePwdEmail(user.getId(), newPwd, email);
   return FrontUtils.showSuccess(request, model, nextUrl);
 }
Пример #2
0
 @RequestMapping("/data/o_revert.do")
 public String revert(
     String filename,
     String db,
     ModelMap model,
     HttpServletRequest request,
     HttpServletResponse response)
     throws IOException {
   String backpath = realPathResolver.get(Constants.BACKUP_PATH);
   String backFilePath = backpath + SLASH + filename;
   String sql = readFile(backFilePath);
   // 还原暂时没做备份提示。
   dataBackMng.executeSQL("use " + SPLIT + db + SPLIT + BR);
   dataBackMng.executeSQL(sql);
   // 若db发生变化,需要处理jdbc
   try {
     String defaultCatalog = dataBackMng.getDefaultCatalog();
     if (!defaultCatalog.equals(db)) {
       String dbXmlPath = realPathResolver.get(dbXmlFileName);
       dbXml(dbXmlPath, defaultCatalog, db);
     }
   } catch (Exception e) {
     WebErrors errors = WebErrors.create(request);
     errors.addErrorCode("db.revert.error");
     errors.addErrorString(e.getMessage());
     if (errors.hasErrors()) {
       return errors.showErrorPage(model);
     }
   }
   // 需要重启web服务器,可能会存在bug
   session.setAttribute(request, response, AUTH_KEY, null);
   request.getSession().invalidate();
   return "login";
 }
Пример #3
0
 @RequestMapping(value = "/register.jspx", method = RequestMethod.POST)
 public String submit(
     String username,
     String email,
     String password,
     CmsUserExt userExt,
     String captcha,
     String nextUrl,
     HttpServletRequest request,
     HttpServletResponse response,
     ModelMap model)
     throws IOException {
   CmsSite site = CmsUtils.getSite(request);
   WebErrors errors = validateSubmit(username, email, password, captcha, site, request, response);
   if (errors.hasErrors()) {
     return FrontUtils.showError(request, response, model, errors);
   }
   String ip = RequestUtils.getIpAddr(request);
   cmsUserMng.registerMember(username, email, password, ip, null, userExt);
   log.info("member register success. username={}", username);
   if (!StringUtils.isBlank(nextUrl)) {
     response.sendRedirect(nextUrl);
     return null;
   } else {
     return FrontUtils.showMessage(request, model, "global.success");
   }
 }
Пример #4
0
 @RequestMapping("/ftp/v_edit.do")
 public String edit(Integer id, HttpServletRequest request, ModelMap model) {
   WebErrors errors = validateEdit(id, request);
   if (errors.hasErrors()) {
     return errors.showErrorPage(model);
   }
   model.addAttribute("ftp", manager.findById(id));
   return "ftp/edit";
 }
Пример #5
0
 @RequestMapping("/item/v_edit.do")
 public String edit(Integer id, HttpServletRequest request, ModelMap model) {
   WebErrors errors = validateEdit(id, request);
   if (errors.hasErrors()) {
     return errors.showErrorPage(model);
   }
   CmsModelItem item = manager.findById(id);
   model.addAttribute("cmsModelItem", item);
   return "item/edit";
 }
Пример #6
0
 @RequestMapping("/vote_topic/v_edit.do")
 public String edit(Integer id, Integer pageNo, HttpServletRequest request, ModelMap model) {
   WebErrors errors = validateEdit(id, request);
   if (errors.hasErrors()) {
     return errors.showErrorPage(model);
   }
   model.addAttribute("cmsVoteTopic", manager.findById(id));
   model.addAttribute("pageNo", pageNo);
   return "vote_topic/edit";
 }
Пример #7
0
 @RequestMapping("/ftp/o_save.do")
 public String save(Ftp bean, HttpServletRequest request, ModelMap model) {
   WebErrors errors = validateSave(bean, request);
   if (errors.hasErrors()) {
     return errors.showErrorPage(model);
   }
   bean = manager.save(bean);
   log.info("save Ftp id={}", bean.getId());
   cmsLogMng.operating(request, "ftp.log.save", "id=" + bean.getId() + ";name=" + bean.getName());
   return "redirect:v_list.do";
 }
Пример #8
0
 @RequestMapping("/item/o_update.do")
 public String update(CmsModelItem bean, HttpServletRequest request, ModelMap model) {
   WebErrors errors = validateUpdate(bean.getId(), bean, request);
   if (errors.hasErrors()) {
     return errors.showErrorPage(model);
   }
   bean = manager.update(bean);
   log.info("update CmsModelItem id={}.", bean.getId());
   model.addAttribute("modelId", bean.getModel().getId());
   model.addAttribute("isChannel", bean.getChannel());
   return "redirect:v_list.do";
 }
Пример #9
0
 @RequestMapping("/vote_topic/o_delete.do")
 public String delete(Integer[] ids, Integer pageNo, HttpServletRequest request, ModelMap model) {
   WebErrors errors = validateDelete(ids, request);
   if (errors.hasErrors()) {
     return errors.showErrorPage(model);
   }
   CmsVoteTopic[] beans = manager.deleteByIds(ids);
   for (CmsVoteTopic bean : beans) {
     log.info("delete CmsVoteTopic id={}", bean.getId());
     cmsLogMng.operating(
         request, "cmsVoteTopic.log.delete", "id=" + bean.getId() + ";title=" + bean.getTitle());
   }
   return list(pageNo, request, model);
 }
Пример #10
0
 @RequestMapping("/ftp/o_delete.do")
 public String delete(Integer[] ids, Integer pageNo, HttpServletRequest request, ModelMap model) {
   WebErrors errors = validateDelete(ids, request);
   if (errors.hasErrors()) {
     return errors.showErrorPage(model);
   }
   Ftp[] beans = manager.deleteByIds(ids);
   for (Ftp bean : beans) {
     log.info("delete Ftp id={}", bean.getId());
     cmsLogMng.operating(
         request, "ftp.log.delete", "id=" + bean.getId() + ";name=" + bean.getName());
   }
   return list(pageNo, request, model);
 }
Пример #11
0
 @RequestMapping("/ftp/o_update.do")
 public String update(Ftp bean, Integer pageNo, HttpServletRequest request, ModelMap model) {
   WebErrors errors = validateUpdate(bean.getId(), request);
   if (errors.hasErrors()) {
     return errors.showErrorPage(model);
   }
   // 留空不修改
   if (StringUtils.isBlank(bean.getPassword())) {
     bean.setPassword(manager.findById(bean.getId()).getPassword());
   }
   bean = manager.update(bean);
   log.info("update Ftp id={}.", bean.getId());
   cmsLogMng.operating(
       request, "ftp.log.update", "id=" + bean.getId() + ";name=" + bean.getName());
   return list(pageNo, request, model);
 }
Пример #12
0
 @RequestMapping("/item/o_delete.do")
 public String delete(
     Integer[] ids,
     Integer modelId,
     Boolean isChannel,
     HttpServletRequest request,
     ModelMap model) {
   WebErrors errors = validateDelete(ids, request);
   if (errors.hasErrors()) {
     return errors.showErrorPage(model);
   }
   CmsModelItem[] beans = manager.deleteByIds(ids);
   for (CmsModelItem bean : beans) {
     log.info("delete CmsModelItem id={}", bean.getId());
   }
   model.addAttribute("modelId", modelId);
   model.addAttribute("isChannel", isChannel);
   return "redirect:v_list.do";
 }
Пример #13
0
 @RequestMapping("/vote_topic/o_save.do")
 public String save(
     CmsVoteTopic bean,
     String[] itemTitle,
     Integer[] itemVoteCount,
     Integer[] itemPriority,
     HttpServletRequest request,
     ModelMap model) {
   WebErrors errors = validateSave(bean, request);
   if (errors.hasErrors()) {
     return errors.showErrorPage(model);
   }
   List<CmsVoteItem> items = getItems(null, itemTitle, itemVoteCount, itemPriority);
   bean = manager.save(bean, items);
   log.info("save CmsVoteTopic id={}", bean.getId());
   cmsLogMng.operating(
       request, "cmsVoteTopic.log.save", "id=" + bean.getId() + ";title=" + bean.getTitle());
   return "redirect:v_list.do";
 }
Пример #14
0
 @RequestMapping("/data/o_delete.do")
 public String delete(
     String root,
     String[] names,
     HttpServletRequest request,
     ModelMap model,
     HttpServletResponse response) {
   WebErrors errors = validateDelete(names, request);
   if (errors.hasErrors()) {
     return errors.showErrorPage(model);
   }
   int count = resourceMng.delete(names);
   log.info("delete Resource count: {}", count);
   for (String name : names) {
     log.info("delete Resource name={}", name);
     cmsLogMng.operating(request, "resource.log.delete", "filename=" + name);
   }
   model.addAttribute("root", root);
   return listBackUpFiles(model, request, response);
 }
Пример #15
0
 @RequestMapping("/vote_topic/o_update.do")
 public String update(
     CmsVoteTopic bean,
     Integer[] itemId,
     String[] itemTitle,
     Integer[] itemVoteCount,
     Integer[] itemPriority,
     Integer pageNo,
     HttpServletRequest request,
     ModelMap model) {
   WebErrors errors = validateUpdate(bean.getId(), request);
   if (errors.hasErrors()) {
     return errors.showErrorPage(model);
   }
   List<CmsVoteItem> items = getItems(itemId, itemTitle, itemVoteCount, itemPriority);
   bean = manager.update(bean, items);
   log.info("update CmsVoteTopic id={}.", bean.getId());
   cmsLogMng.operating(
       request, "cmsVoteTopic.log.update", "id=" + bean.getId() + ";title=" + bean.getTitle());
   return list(pageNo, request, model);
 }