コード例 #1
0
 private Member currentMember() {
   ShiroUser user = currentUser();
   Member member = new Member();
   member.setUsername(user.getUserName());
   member.setId(user.getUserId());
   return member;
 }
コード例 #2
0
  /**
   * Description:发送手机认证验证码<br>
   *
   * @author justin.xu
   * @version 0.1 2014年4月29日
   * @param request
   * @param session
   * @return String
   */
  @RequestMapping(value = "activeMobileAndSendMsg")
  @ResponseBody
  public String activeMobileAndSendMsg(
      HttpServletRequest request, HttpSession session, String mobile, String activeCode) {
    String result = "success";
    try {
      ShiroUser shiroUser = currentUser();
      result =
          mobileApproService.sendMobileApprValidate(
              mobile, request, shiroUser.getUserName(), BusinessConstants.MOBILE_APPRO_FUNCTION);
      MemberVo memberVo = new MemberVo();
      memberVo.setId(shiroUser.getUserId());

      // mobileApproService.packageMobileApproCode(memberVo, mobile,
      // activeCode, request);
    } catch (Exception e) {
      result = "网络连接异常,请刷新页面或稍后重试!";
      e.printStackTrace();
    }
    return result;
  }
コード例 #3
0
 /**
  * Description:跳转到会员邮箱和手机认证界面<br>
  *
  * @author hujianpan
  * @version 0.1 2014年8月30日
  * @param memberRegisterCnd
  * @return String
  */
 @RequestMapping(value = "/toCheckMemberInfo")
 public ModelAndView checkMemberInfo(HttpServletRequest request) {
   Member member = new Member();
   ShiroUser shiroUser = currentUser();
   member.setId(shiroUser.getUserId());
   member.setUsername(shiroUser.getUserName());
   if (null == member || StringUtils.isEmpty(member.getUsername())) {
     return redirect("/" + BusinessConstants.TOP_HOME_ADDRESS);
   }
   // 通过用户名查询上一步的信息
   MemberCnd memberCnd = new MemberCnd();
   memberCnd.setUsername(member.getUsername());
   MemberVo memberVo = memberService.queryMemberByCnd(memberCnd);
   // 0:正式身份 -1:游客身份
   if (null != memberVo && BusinessConstants.VISITOR_OFFICIAL == memberVo.getType()) {
     logger.info("当前用户已经认证通过");
     return redirect("/" + BusinessConstants.TOP_HOME_ADDRESS);
   }
   return forword("/member/register_CheckMember")
       .addObject("currentEmail", memberVo.getEmail() == null ? "" : memberVo.getEmail());
 }
コード例 #4
0
 /**
  * Description:根据当前用户的手机号发送验证码<br>
  *
  * @author justin.xu
  * @version 0.1 2014年4月30日
  * @param request
  * @param session
  * @return String
  */
 @RequestMapping(value = "sendResetMsg")
 @ResponseBody
 public MessageBox sendResetMsg(HttpServletRequest request, HttpSession session) {
   String result = BusinessConstants.SUCCESS;
   try {
     ShiroUser shiroUser = currentUser();
     MobileApproVo mobileApproVo =
         mobileApproService.queryMobileApproByUserId(shiroUser.getUserId());
     result =
         mobileApproService.sendMobileApprValidate(
             mobileApproVo.getMobileNum(),
             request,
             shiroUser.getUserName(),
             BusinessConstants.MOBILE_APPRO_RESET_FUNCTION,
             BusinessConstants.SMS_TEMPLATE_TYPE_VERIFY_MOBILE_CODE);
   } catch (Exception e) {
     result = "网络连接异常,请刷新页面或稍后重试!";
     e.printStackTrace();
   }
   if (BusinessConstants.SUCCESS.equals(result)) {
     return new MessageBox("1", "验证码发送成功,请查收手机短信。");
   }
   return new MessageBox("0", result);
 }