コード例 #1
0
ファイル: LoginService.java プロジェクト: huaj12/weguan
 @Override
 public long login(
     HttpServletRequest request,
     HttpServletResponse response,
     String loginName,
     String pwd,
     boolean persistent)
     throws PassportAccountException {
   loginName = StringUtils.trim(loginName);
   pwd = StringUtils.trim(pwd);
   if (StringUtils.isEmpty(loginName) || StringUtils.isEmpty(pwd)) {
     throw new PassportAccountException(PassportAccountException.ACCOUNT_OR_PWD_ERROR);
   }
   Passport passport = passportService.getPassportByLoginName(loginName);
   if (null == passport || !StringUtils.equals(passport.getPassword(), DigestUtils.md5Hex(pwd))) {
     throw new PassportAccountException(PassportAccountException.ACCOUNT_OR_PWD_ERROR);
   }
   Thirdparty tp = null;
   TpUser tpUser = tpUserService.getTpUserByUid(passport.getId());
   if (null != tpUser) {
     tp = InitData.getTpByTpNameAndJoinType(tpUser.getTpName(), JoinTypeEnum.CONNECT);
   }
   doLogin(
       request, response, passport.getId(), tp != null ? tp.getId() : 0L, RunType.WEB, persistent);
   nativeLoginCounter.incr(null, 1);
   return passport.getId();
 }
コード例 #2
0
ファイル: LoginService.java プロジェクト: huaj12/weguan
 @Override
 public void login(
     HttpServletRequest request,
     HttpServletResponse response,
     final long uid,
     final long tpId,
     RunType runType)
     throws PassportAccountException {
   doLogin(request, response, uid, tpId, runType, false);
   loginCounter.incr(null, 1);
 }