Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add additional check during setup #159

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading