diff --git a/src/main/java/fuck/manthe/nmsl/entity/dto/VapeAuthorizeDTO.java b/src/main/java/fuck/manthe/nmsl/entity/dto/VapeAuthorizeDTO.java index a57e803..0101512 100644 --- a/src/main/java/fuck/manthe/nmsl/entity/dto/VapeAuthorizeDTO.java +++ b/src/main/java/fuck/manthe/nmsl/entity/dto/VapeAuthorizeDTO.java @@ -10,11 +10,11 @@ @NoArgsConstructor @Builder public class VapeAuthorizeDTO { - String token; - Status status; + private String token; + private Status status; public enum Status { OK, - SERVLET_ERROR, NO_ACCOUNT, BANNED_OR_INCORRECT + SERVLET_ERROR, NO_ACCOUNT, INCORRECT, BANNED, CLOUDFLARE } } diff --git a/src/main/java/fuck/manthe/nmsl/service/impl/VapeAccountServiceImpl.java b/src/main/java/fuck/manthe/nmsl/service/impl/VapeAccountServiceImpl.java index 79371c2..1a43731 100644 --- a/src/main/java/fuck/manthe/nmsl/service/impl/VapeAccountServiceImpl.java +++ b/src/main/java/fuck/manthe/nmsl/service/impl/VapeAccountServiceImpl.java @@ -159,10 +159,25 @@ public VapeAuthorizeDTO doAuth(VapeAccount vapeAccount) { } if (responseString.length() != 33) { // not a valid token - log.error("Account {} seems banned or incorrect ({})", vapeAccount.getUsername(), responseString); + if (responseString.equals("1006")) { + // Cloudflare captcha + log.error("Your IP address was banned by Manthe. Please switch your VPN endpoint or use a Gateway. ({})", responseString); + return VapeAuthorizeDTO.builder() + .token("Cloudflare") + .status(VapeAuthorizeDTO.Status.CLOUDFLARE) + .build(); + } + if (responseString.equals("102")) { + log.error("Vape account {} was banned. ({})", vapeAccount.getUsername(), responseString); + return VapeAuthorizeDTO.builder() + .token("Disabled") + .status(VapeAuthorizeDTO.Status.BANNED) + .build(); + } + log.error("Auth server responded an error: {} (Account: {})", responseString, vapeAccount.getUsername()); return VapeAuthorizeDTO.builder() .token(responseString) - .status(VapeAuthorizeDTO.Status.BANNED_OR_INCORRECT) + .status(VapeAuthorizeDTO.Status.INCORRECT) .build(); } }