create user: remove ip check

This commit is contained in:
mantikoros 2022-07-25 18:25:23 -07:00
parent 3107c8fe30
commit ec0e25e5ed

View File

@ -63,10 +63,7 @@ export const createuser = newEndpoint(opts, async (req, auth) => {
const deviceUsedBefore =
!deviceToken || (await isPrivateUserWithDeviceToken(deviceToken))
const ipCount = req.ip ? await numberUsersWithIp(req.ip) : 0
const balance =
deviceUsedBefore || ipCount > 2 ? SUS_STARTING_BALANCE : STARTING_BALANCE
const balance = deviceUsedBefore ? SUS_STARTING_BALANCE : STARTING_BALANCE
const user: User = {
id: auth.uid,
@ -113,7 +110,7 @@ const isPrivateUserWithDeviceToken = async (deviceToken: string) => {
return !snap.empty
}
const numberUsersWithIp = async (ipAddress: string) => {
export const numberUsersWithIp = async (ipAddress: string) => {
const snap = await firestore
.collection('private-users')
.where('initialIpAddress', '==', ipAddress)