|  |  |  | 
|---|
|  |  |  | import com.matrix.core.constance.SystemErrorCode; | 
|---|
|  |  |  | import com.matrix.core.exception.GlobleException; | 
|---|
|  |  |  | import com.matrix.core.tools.LogUtil; | 
|---|
|  |  |  | import com.matrix.core.tools.PropertiesUtil; | 
|---|
|  |  |  | import com.matrix.core.tools.StringUtils; | 
|---|
|  |  |  | import com.matrix.core.tools.WebUtil; | 
|---|
|  |  |  | import com.matrix.system.common.bean.SysUserLoginRecord; | 
|---|
|  |  |  | 
|---|
|  |  |  | * @date 2017年12月12日 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | private void accountOrPasswordError(SysUsers loginUser) { | 
|---|
|  |  |  | String errorTimesStr = PropertiesUtil.getString(AppConstance.ERROR_PASSWORD_TIMES); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (StringUtils.isNotBlank(errorTimesStr) && !AppConstance.NOT_VALIDATE_ERROR_TIMES.equals(errorTimesStr)) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int sessionErrorTimes = sysUsersService.countUserTodayErrorLoginTimes(loginUser.getSuAccount()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int errorTimes = Integer.parseInt(errorTimesStr); | 
|---|
|  |  |  | // 当输入的密码错误次数大于设置的次数时,锁定账号 | 
|---|
|  |  |  | if (sessionErrorTimes >= errorTimes) { | 
|---|
|  |  |  | if (sessionErrorTimes >= 5) { | 
|---|
|  |  |  | sysUsersService.lockUser(loginUser.getSuAccount()); | 
|---|
|  |  |  | throw new GlobleException(AppMessageCode.User.ACCOUNT_IS_LOCK); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | addErrorLoginRecord(loginUser, AppConstance.LOGIN_FAIL); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | throw new GlobleException(AppMessageCode.User.ACCOUNT_PASSWORD_ERROR, errorTimesStr, ++sessionErrorTimes, | 
|---|
|  |  |  | errorTimesStr); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|