Ejemplo n.º 1
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");
   }
 }
Ejemplo n.º 2
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);
 }