Skip to content

Commit

Permalink
Merge pull request #159 from complexdatacollective/fix-1
Browse files Browse the repository at this point in the history
add additional check during setup
  • Loading branch information
jthrilly authored Sep 18, 2024
2 parents 93353cc + 32efac8 commit c0dca1b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions app/(blobs)/(setup)/setup/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Suspense } from 'react';
import {
getAnonymousRecruitmentStatus,
getLimitInterviewsStatus,
requireAppNotConfigured,
requireAppNotExpired,
} from '~/queries/appSettings';
import { getServerSession } from '~/utils/auth';
Expand Down Expand Up @@ -33,6 +34,7 @@ export const dynamic = 'force-dynamic';

export default async function Page() {
await requireAppNotExpired(true);
await requireAppNotConfigured();

const setupDataPromise = getSetupData();

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fresco",
"version": "1.0.1",
"version": "1.0.2",
"private": true,
"type": "module",
"packageManager": "[email protected]+sha256.9551e803dcb7a1839fdf5416153a844060c7bce013218ce823410532504ac10b",
Expand Down
11 changes: 11 additions & 0 deletions queries/appSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,17 @@ export async function requireAppNotExpired(isSetupRoute = false) {
return;
}

// Used to prevent user account creation after the app has been configured
export async function requireAppNotConfigured() {
const appSettings = await getAppSettings();

if (appSettings.configured) {
redirect('/');
}

return;
}

export async function isAppExpired() {
const appSettings = await getAppSettings();
return appSettings.expired;
Expand Down

0 comments on commit c0dca1b

Please sign in to comment.