mirror of
https://github.com/spacebarchat/server.git
synced 2026-03-30 16:05:41 +00:00
Ignore empty ASN type/ID in register
This commit is contained in:
@@ -155,14 +155,18 @@ router.post(
|
||||
throw new HTTPError("Your IP is blocked from registration");
|
||||
}
|
||||
|
||||
if (register.blockAsnTypes.includes(ipData.asn.type)) {
|
||||
if (ipData.asn.type && register.blockAsnTypes.includes(ipData.asn.type)) {
|
||||
console.log(`[Register] ${ip} blocked from registration: IPData.co ASN type ${ipData.asn.type} is blocked`);
|
||||
throw new HTTPError("Your IP is blocked from registration");
|
||||
} else if (!ipData.asn.type) {
|
||||
console.log("[Register] IPData.co response missing asn.type field", ipData);
|
||||
}
|
||||
|
||||
if (register.blockAsns.includes(ipData.asn.asn)) {
|
||||
if (ipData.asn.asn && register.blockAsns.includes(ipData.asn.asn)) {
|
||||
console.log(`[Register] ${ip} blocked from registration: IPData.co ASN ${ipData.asn.name} is blocked`);
|
||||
throw new HTTPError("Your IP is blocked from registration");
|
||||
} else if (!ipData.asn.asn) {
|
||||
console.log("[Register] IPData.co response missing asn.asn field", ipData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user