Beispiel #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);
 }
 @RequestMapping("/comment/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("cmsComment", manager.findById(id));
   return "comment/edit";
 }
 @RequestMapping("/site_config/o_base_update.do")
 public String baseUpdate(
     CmsSite bean, Integer uploadFtpId, HttpServletRequest request, ModelMap model) {
   WebErrors errors = validateBaseUpdate(bean, request);
   if (errors.hasErrors()) {
     return errors.showErrorPage(model);
   }
   CmsSite site = CmsUtils.getSite(request);
   bean.setId(site.getId());
   bean = manager.update(bean, uploadFtpId);
   model.addAttribute("message", "global.success");
   log.info("update CmsSite success. id={}", site.getId());
   cmsLogMng.operating(request, "cmsSiteConfig.log.updateBase", null);
   return baseEdit(request, model);
 }
 @RequestMapping("/comment/o_delete.do")
 public String delete(
     Integer queryContentId,
     Boolean queryChecked,
     Boolean queryRecommend,
     Integer[] ids,
     Integer pageNo,
     HttpServletRequest request,
     ModelMap model) {
   WebErrors errors = validateDelete(ids, request);
   if (errors.hasErrors()) {
     return errors.showErrorPage(model);
   }
   CmsComment[] beans = manager.deleteByIds(ids);
   for (CmsComment bean : beans) {
     log.info("delete CmsComment id={}", bean.getId());
     cmsLogMng.operating(request, "cmsComment.log.delete", "id=" + bean.getId());
   }
   return list(queryContentId, queryChecked, queryRecommend, pageNo, request, model);
 }
 @RequestMapping("/comment/o_update.do")
 public String update(
     Integer queryContentId,
     Boolean queryChecked,
     Boolean queryRecommend,
     String reply,
     CmsComment bean,
     CmsCommentExt ext,
     Integer pageNo,
     HttpServletRequest request,
     ModelMap model) {
   WebErrors errors = validateUpdate(bean.getId(), request);
   if (errors.hasErrors()) {
     return errors.showErrorPage(model);
   }
   // 若回复内容不为空而且回复更新,则设置回复时间,已最新回复时间为准
   if (StringUtils.isNotBlank(ext.getReply()) && !reply.equals(ext.getReply())) {
     bean.setReplayTime(new Date());
   }
   bean = manager.update(bean, ext);
   log.info("update CmsComment id={}.", bean.getId());
   cmsLogMng.operating(request, "cmsComment.log.update", "id=" + bean.getId());
   return list(queryContentId, queryChecked, queryRecommend, pageNo, request, model);
 }