Skip to content

Commit

Permalink
Only permitting validated accounts to perform sitemap scans
Browse files Browse the repository at this point in the history
  • Loading branch information
heythisischris committed Sep 11, 2024
1 parent 139e244 commit 6cc56cf
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/routes/addScans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ export const addScans = async ({ request, reply }) => {
await db.connect();
for (const propertyId of request.body.propertyIds ?? []) {
const property = (await db.query(`SELECT "id", "discovery", "property_url" FROM "properties" WHERE "id"=$1`, [propertyId])).rows?.[0];
const userIsValidated = (await db.query(`SELECT "validated" FROM "users" WHERE "id"=$1`, [jwtClaims.sub])).rows?.[0]?.validated;
if (!userIsValidated && property.discovery === 'sitemap') {
return {
status: 'user_not_validated',
message: 'We must validate your account before permitting sitemap scans.',
}
}

if (!property.discovery) {
return {
status: 'error',
Expand Down

0 comments on commit 6cc56cf

Please sign in to comment.