Allow Singapore login region

This commit is contained in:
hy001 2026-05-19 14:04:40 +08:00
parent 32a1094edc
commit 1e94443ee5
4 changed files with 8 additions and 8 deletions

View File

@ -39,10 +39,10 @@ public class LoginAccessValidationService {
"香港", "澳门", "澳門", "台湾", "台灣", "Hong Kong", "Macau", "Macao", "Taiwan"
);
private static final List<String> BLOCKED_COUNTRY_CODES = List.of(
"MO", "SG"
"MO"
);
private static final List<String> BLOCKED_COUNTRY_NAMES = List.of(
"澳门", "澳門", "Macau", "Macao", "新加坡", "Singapore"
"澳门", "澳門", "Macau", "Macao"
);
private static final List<IpGeoProvider> IP_GEO_PROVIDERS = List.of(
new IpGeoProvider("ip.sb", "https://api.ip.sb/geoip/%s"),

View File

@ -98,12 +98,12 @@ public class LoginAccessValidationServiceTest {
}
@Test
public void blockSingaporeCountryCode() {
public void allowSingaporeCountryCode() {
JSONObject data = JSON.parseObject("""
{"country_id":"SG","country":"Singapore","region":""}
""");
assertTrue(LoginAccessValidationService.isBlockedIpRegion(data));
assertFalse(LoginAccessValidationService.isBlockedIpRegion(data));
}
@Test

View File

@ -32,10 +32,10 @@ public class IpCountryUtils {
"香港", "澳门", "澳門", "台湾", "台灣", "Hong Kong", "Macau", "Macao", "Taiwan"
);
private static final List<String> BLOCKED_COUNTRY_CODES = List.of(
"MO", "SG"
"MO"
);
private static final List<String> BLOCKED_COUNTRY_NAMES = List.of(
"澳门", "澳門", "Macau", "Macao", "新加坡", "Singapore"
"澳门", "澳門", "Macau", "Macao"
);
private static final List<IpGeoProvider> IP_GEO_PROVIDERS = List.of(
new IpGeoProvider("ip.sb", "https://api.ip.sb/geoip/%s"),

View File

@ -92,10 +92,10 @@ public class IpCountryUtilsTest {
}
@Test
public void blockSingaporeCountryCode() {
public void allowSingaporeCountryCode() {
IpCountryUtils.IpGeoData data = new IpCountryUtils.IpGeoData("SG", "Singapore", "", "test");
assertTrue(IpCountryUtils.isBlockedIpRegion(data));
assertFalse(IpCountryUtils.isBlockedIpRegion(data));
}
@Test