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:
@@ -5,6 +5,16 @@ import Link from "next/link";
|
||||
import { format } from "date-fns";
|
||||
import { tr } from "date-fns/locale";
|
||||
|
||||
type PortalTaskRow = {
|
||||
id: string;
|
||||
title: string;
|
||||
status: string;
|
||||
project_id: string;
|
||||
created_at: string;
|
||||
date: string | null;
|
||||
priority: string | null;
|
||||
};
|
||||
|
||||
export default async function PortalTasksPage() {
|
||||
const supabase = await createClient();
|
||||
const { data: { user } } = await supabase.auth.getUser();
|
||||
@@ -32,7 +42,7 @@ export default async function PortalTasksPage() {
|
||||
|
||||
const projectIds = projectsData?.map(p => p.id) || [];
|
||||
|
||||
let tasks = [];
|
||||
let tasks: PortalTaskRow[] = [];
|
||||
if (projectIds.length > 0) {
|
||||
const { data: tasksData } = await supabase
|
||||
.from("tasks")
|
||||
|
||||
Reference in New Issue
Block a user