修改

parent 6d068069
......@@ -36,6 +36,7 @@ public interface Constants {
String REDIS_VOICE_DEVICE_COUNT = "Voice_Device_verification_code_count:";
String REDIS_VERIFICATION_COUNT = "verification_code_count:";
final Long Image_Need_Count=3L;
/**
* redis中token的key值前缀
*/
......
......@@ -87,7 +87,7 @@ public class CaptchaNewValidateAdvisor {
Long countPhone = countPhone(phoneNo);
Long countDeviceId = countDeviceId(deviceId);
if (countIP > 3 || countPhone > 3 || countDeviceId > 3) {
if (countIP > Constants.Image_Need_Count || countPhone > Constants.Image_Need_Count || countDeviceId > Constants.Image_Need_Count) {
if (shouldSkipCaptchaValidate(registerFrom, captchaId, captchaValue)) {
LOGGER.info("使用超级图形验证码校验, registerFrom={}, clientIp={}", registerFrom, request.getRemoteAddr());
......
......@@ -325,6 +325,13 @@ public class SmsController implements IBaseController {
}
}
/**
* 判断下次是否提示图形验证码
* @param clientIp
* @param deviceId
* @param phoneNo
* @return
*/
private boolean needImageVlidate(String clientIp, String deviceId, String phoneNo) {
boolean need = false;
String countIP = redisTemplate.opsForValue().get(IMAGE_IP_COUNT + clientIp);
......@@ -333,7 +340,7 @@ public class SmsController implements IBaseController {
Long ip = StringUtils.isBlank(countIP) ? 1L : Long.valueOf(countIP);
Long devId = StringUtils.isBlank(countDeviceId) ? 1L : Long.valueOf(countDeviceId);
Long phNo = StringUtils.isBlank(countPhoneNo) ? 1L : Long.valueOf(countPhoneNo);
if (ip >= 3L || devId >= 3L || phNo >= 3L) {
if (ip >= Constants.Image_Need_Count || devId >= Constants.Image_Need_Count || phNo >= Constants.Image_Need_Count ) {
need = true;
}
return need;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment