@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"); } }
@RequestMapping(value = "/register.jspx", method = RequestMethod.GET) public String input(HttpServletRequest request, HttpServletResponse response, ModelMap model) { CmsSite site = CmsUtils.getSite(request); MemberConfig mcfg = site.getConfig().getMemberConfig(); // 没有开启会员功能 if (!mcfg.isMemberOn()) { return FrontUtils.showMessage(request, model, "member.memberClose"); } // 没有开启会员注册 if (!mcfg.isRegisterOn()) { return FrontUtils.showMessage(request, model, "member.registerClose"); } FrontUtils.frontData(request, model, site); model.addAttribute("mcfg", mcfg); return FrontUtils.getTplPath(request, site.getSolutionPath(), TPLDIR_MEMBER, REGISTER); }
/** * 密码修改提交页 * * @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); }
/** * 个人资料提交页 * * @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); }