/** * 密码修改提交页 * * @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); }
/** * 会员中心页 * * <p>如果没有登录则跳转到登陆页 * * @param request * @param response * @param model * @return */ @RequestMapping(value = "/member/index.jspx", method = RequestMethod.GET) public String index(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); } return FrontUtils.getTplPath(request, site.getSolutionPath(), TPLDIR_MEMBER, MEMBER_CENTER); }
@RequestMapping("/comment/v_list.do") public String list( Integer queryContentId, Boolean queryChecked, Boolean queryRecommend, Integer pageNo, HttpServletRequest request, ModelMap model) { if (queryRecommend == null) { queryRecommend = false; } CmsSite site = CmsUtils.getSite(request); Pagination pagination = manager.getPage( site.getId(), queryContentId, null, queryChecked, queryRecommend, true, cpn(pageNo), CookieUtils.getPageSize(request)); model.addAttribute("pagination", pagination); return "comment/list"; }
private WebErrors validateUpdate(Integer id, HttpServletRequest request) { WebErrors errors = WebErrors.create(request); CmsSite site = CmsUtils.getSite(request); if (vldExist(id, site.getId(), errors)) { return errors; } return errors; }
@RequestMapping("/site_config/v_base_edit.do") public String baseEdit(HttpServletRequest request, ModelMap model) { CmsSite site = CmsUtils.getSite(request); List<Ftp> ftpList = ftpMng.getList(); model.addAttribute("ftpList", ftpList); model.addAttribute("cmsSite", site); return "site_config/base_edit"; }
private WebErrors validateDelete(Integer[] ids, HttpServletRequest request) { WebErrors errors = WebErrors.create(request); CmsSite site = CmsUtils.getSite(request); if (errors.ifEmpty(ids, "ids")) { return errors; } for (Integer id : ids) { vldExist(id, site.getId(), errors); } return errors; }
/** * 个人资料提交页 * * @param request * @param response * @param model * @return * @throws IOException */ @RequestMapping(value = "/member/profile.jspx", method = RequestMethod.POST) public String profileSubmit( CmsUserExt ext, 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); } ext.setId(user.getId()); cmsUserExtMng.update(ext, user); log.info("update CmsUserExt success. id={}", user.getId()); return FrontUtils.showSuccess(request, model, nextUrl); }
@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); }
/** * 验证密码是否正确 * * @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"); }