feat: Implement first admin setup guard to lock registration after initial account creation

- Updated the registration flow to check if the first admin account has been created, preventing further public registrations.
- Introduced `is_first_admin_setup_available` function to determine registration availability.
- Modified the `/register` and `/login` pages to redirect based on the setup state.
- Enhanced the user creation process to handle internal admin accounts correctly.
- Added migration script to enforce the new registration rules in the database.
- Refactored chat API to improve message handling and context building.
- Updated dashboard and settings components for better state management.
- Improved error handling and user feedback across various components.
This commit is contained in:
Poyraz Avsever
2026-06-08 16:22:26 +03:00
parent cf8492db9e
commit 950522d467
15 changed files with 570 additions and 445 deletions
+9 -1
View File
@@ -5,6 +5,14 @@ import Link from "next/link";
import { format } from "date-fns";
import { tr } from "date-fns/locale";
type RevisionRow = {
id: string;
description: string;
status: string;
project_id: string;
created_at: string;
};
export default async function PortalRevisionsPage() {
const supabase = await createClient();
const { data: { user } } = await supabase.auth.getUser();
@@ -32,7 +40,7 @@ export default async function PortalRevisionsPage() {
const projectIds = projectsData?.map(p => p.id) || [];
let revisions = [];
let revisions: RevisionRow[] = [];
if (projectIds.length > 0) {
const { data: revisionsData } = await supabase
.from("project_revisions")