(radar) Remove IP ban system

This commit is contained in:
Baptiste Arnaud
2024-01-02 10:16:10 +01:00
parent 624642974b
commit 7ce1a4d3d1
4 changed files with 5 additions and 46 deletions

View File

@@ -89,13 +89,7 @@ export const SignInForm = ({
redirect: false,
})
if (response?.error) {
if (response.error.includes('ip-banned'))
showToast({
status: 'info',
description:
'Your account has suspicious activity and is being reviewed by our team. Feel free to contact us.',
})
else if (response.error.includes('rate-limited'))
if (response.error.includes('rate-limited'))
showToast({
status: 'info',
description: t('auth.signinErrorToast.tooManyRequests'),

View File

@@ -41,7 +41,7 @@ export const publishTypebot = authenticatedProcedure
message: z.literal('success'),
})
)
.mutation(async ({ input: { typebotId }, ctx: { user, ip } }) => {
.mutation(async ({ input: { typebotId }, ctx: { user } }) => {
const existingTypebot = await prisma.typebot.findFirst({
where: {
id: typebotId,
@@ -102,7 +102,7 @@ export const publishTypebot = authenticatedProcedure
const riskLevel = typebotWasVerified ? 0 : computeRiskLevel(existingTypebot)
if (riskLevel > 0 && riskLevel !== existingTypebot.riskLevel) {
if (env.MESSAGE_WEBHOOK_URL && riskLevel !== 100)
if (env.MESSAGE_WEBHOOK_URL && riskLevel !== 100 && riskLevel > 60)
await fetch(env.MESSAGE_WEBHOOK_URL, {
method: 'POST',
body: `⚠️ Suspicious typebot to be reviewed: ${existingTypebot.name} (${env.NEXTAUTH_URL}/typebots/${existingTypebot.id}/edit) (workspace: ${existingTypebot.workspaceId})`,
@@ -125,21 +125,6 @@ export const publishTypebot = authenticatedProcedure
id: existingTypebot.publishedTypebot.id,
},
})
if (ip) {
const isIpAlreadyBanned = await prisma.bannedIp.findFirst({
where: {
ip,
},
})
if (!isIpAlreadyBanned)
await prisma.bannedIp.create({
data: {
ip,
responsibleTypebotId: existingTypebot.id,
userId: user.id,
},
})
}
throw new TRPCError({
code: 'FORBIDDEN',
message: