mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-24 19:25:13 +01:00
Ignore country check for localhost.
- don't log exception to console
This commit is contained in:
parent
64688c7ae6
commit
fbdd56d9de
@ -89,11 +89,11 @@ public class GeoLiteAPI {
|
|||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
public static String getCountryCode(String ip) {
|
public static String getCountryCode(String ip) {
|
||||||
if (isDataAvailable()) {
|
if (!"127.0.0.1".equals(ip) && isDataAvailable()) {
|
||||||
try {
|
try {
|
||||||
return databaseReader.country(InetAddress.getByName(ip)).getCountry().getIsoCode();
|
return databaseReader.country(InetAddress.getByName(ip)).getCountry().getIsoCode();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
ConsoleLogger.logException("Error while getting country code", e);
|
ConsoleLogger.writeStackTrace(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "--";
|
return "--";
|
||||||
@ -107,11 +107,11 @@ public class GeoLiteAPI {
|
|||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
public static String getCountryName(String ip) {
|
public static String getCountryName(String ip) {
|
||||||
if (isDataAvailable()) {
|
if (!"127.0.0.1".equals(ip) && isDataAvailable()) {
|
||||||
try {
|
try {
|
||||||
return databaseReader.country(InetAddress.getByName(ip)).getCountry().getName();
|
return databaseReader.country(InetAddress.getByName(ip)).getCountry().getName();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
ConsoleLogger.logException("Error while getting country name", e);
|
ConsoleLogger.writeStackTrace(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "N/A";
|
return "N/A";
|
||||||
|
Loading…
Reference in New Issue
Block a user