| | |
| | | /** |
| | | * 登录验证 |
| | | * |
| | | * @param username 用户名 |
| | | * @param username 用户名或手机号 |
| | | * @param password 密码 |
| | | * @param code 验证码 |
| | | * @param uuid 唯一标识 |
| | |
| | | |
| | | /** |
| | | * 登录前置校验 |
| | | * @param username 用户名 |
| | | * @param username 用户名或手机号 |
| | | * @param password 用户密码 |
| | | */ |
| | | public void loginPreCheck(String username, String password) |
| | |
| | | AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match"))); |
| | | throw new UserPasswordNotMatchException(); |
| | | } |
| | | // 用户名不在指定范围内 错误 |
| | | if (username.length() < UserConstants.USERNAME_MIN_LENGTH |
| | | || username.length() > UserConstants.USERNAME_MAX_LENGTH) |
| | | // 判断是否为手机号登录 |
| | | boolean isPhoneLogin = username.matches("^1[3-9]\\d{9}$"); |
| | | |
| | | // 如果不是手机号登录,检查用户名长度 |
| | | if (!isPhoneLogin) |
| | | { |
| | | AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match"))); |
| | | throw new UserPasswordNotMatchException(); |
| | | // 用户名不在指定范围内 错误 |
| | | if (username.length() < UserConstants.USERNAME_MIN_LENGTH |
| | | || username.length() > UserConstants.USERNAME_MAX_LENGTH) |
| | | { |
| | | AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match"))); |
| | | throw new UserPasswordNotMatchException(); |
| | | } |
| | | } |
| | | |
| | | // IP黑名单校验 |
| | | String blackStr = configService.selectConfigByKey("sys.login.blackIPList"); |
| | | if (IpUtils.isMatchedIp(blackStr, IpUtils.getIpAddr())) |