disables per-user IP limit by default

This commit is contained in:
nai-degen
2023-05-14 14:42:56 -05:00
parent 9ff7381f31
commit 3f46d132f7
2 changed files with 10 additions and 4 deletions
+4 -2
View File
@@ -136,7 +136,9 @@ export function authenticate(token: string, ip: string) {
if (!user.ip.includes(ip)) user.ip.push(ip);
// If too many IPs are associated with the user, disable the account.
if (user.ip.length > MAX_IPS_PER_USER && user.type !== "special") {
const ipLimit =
user.type === "special" || !MAX_IPS_PER_USER ? Infinity : MAX_IPS_PER_USER;
if (user.ip.length > ipLimit) {
disableUser(token, "Too many IP addresses associated with this token.");
return;
}
@@ -200,7 +202,7 @@ async function flushUsers() {
if (numUpdates === 0) {
return;
}
await usersRef.update(updates);
logger.info(
{ users: Object.keys(updates).length },