Canlıya alınan hatalar düzeltildi.

This commit is contained in:
2025-12-30 00:32:26 +03:00
parent b3bceaaff5
commit 922feb8de3
7 changed files with 11 additions and 15 deletions

View File

@@ -6,7 +6,6 @@ import { OTPTemplate } from "@/components/emails/otp-template"
import { verifyCaptcha } from "@/lib/captcha"
import { checkRateLimit, incrementRateLimit, logActivity } from '@/lib/security'
import { cookies } from "next/headers"
import { redirect } from "next/navigation"
import { compare } from 'bcryptjs'

View File

@@ -18,7 +18,7 @@ export default function VerifyPage() {
const [isLoading, setIsLoading] = useState(false)
const [isResending, setIsResending] = useState(false)
const router = useRouter()
const captchaRef = useRef<any>(null)
const captchaRef = useRef<{ reset: () => void }>(null)
const handleVerify = async (e: React.FormEvent) => {
e.preventDefault()

View File

@@ -4,8 +4,6 @@ import { createClient } from "@/lib/supabase/server"
import { revalidatePath } from "next/cache"
import { logAction } from "@/lib/logger"
import { sendEmail } from "@/lib/email"
import { ReservationCancelledTemplate } from "@/components/emails/reservation-cancelled-template"
export async function addPayment(reservationId: string, formData: FormData) {
const supabase = await createClient()

View File

@@ -4,8 +4,6 @@ import { createClient } from "@/lib/supabase/server"
import { revalidatePath } from "next/cache"
import { redirect } from "next/navigation"
import { logAction } from "@/lib/logger"
import { sendEmail } from "@/lib/email"
import { ReservationCreatedTemplate } from "@/components/emails/reservation-created-template"
export async function createReservation(data: {
hall_id: string

View File

@@ -14,14 +14,14 @@ import { Badge } from "@/components/ui/badge"
import { Button } from "@/components/ui/button"
interface LogTabsProps {
auditLogs: any[]
securityLogs: any[]
auditLogs: Record<string, unknown>[]
securityLogs: Record<string, unknown>[]
}
export function LogTabs({ auditLogs, securityLogs }: LogTabsProps) {
const [activeTab, setActiveTab] = useState<'business' | 'security'>('business')
const getSecurityBadgeColor = (type: string) => {
const getSecurityBadgeColor = (type: string): "default" | "destructive" | "secondary" | "outline" => {
switch (type) {
case 'login_success': return 'default'
case 'login_failed': return 'destructive'
@@ -79,7 +79,8 @@ export function LogTabs({ auditLogs, securityLogs }: LogTabsProps) {
</TableRow>
</TableHeader>
<TableBody>
{auditLogs?.map((log) => (
{/* eslint-disable-next-line @typescript-eslint/no-explicit-any */}
{auditLogs?.map((log: any) => (
<TableRow key={log.id}>
<TableCell>{new Date(log.created_at).toLocaleString('tr-TR')}</TableCell>
<TableCell className="font-medium">{log.action}</TableCell>
@@ -121,11 +122,12 @@ export function LogTabs({ auditLogs, securityLogs }: LogTabsProps) {
</TableRow>
</TableHeader>
<TableBody>
{securityLogs?.map((log) => (
{/* eslint-disable-next-line @typescript-eslint/no-explicit-any */}
{securityLogs?.map((log: any) => (
<TableRow key={log.id}>
<TableCell>{new Date(log.created_at).toLocaleString('tr-TR')}</TableCell>
<TableCell>
<Badge variant={getSecurityBadgeColor(log.event_type) as any}>
<Badge variant={getSecurityBadgeColor(log.event_type)}>
{formatSecurityEvent(log.event_type)}
</Badge>
</TableCell>

View File

@@ -1,4 +1,4 @@
import { createHmac, randomBytes } from 'crypto'
import { createHmac } from 'crypto'
export interface CaptchaData {
image: string // SVG string

View File

@@ -7,7 +7,7 @@ export type SecurityEventType = 'login_success' | 'login_failed' | 'otp_sent' |
export async function logActivity(
userId: string | null,
eventType: SecurityEventType,
details: Record<string, any> = {}
details: Record<string, unknown> = {}
) {
try {
// Use Admin Client to bypass RLS for inserting logs
@@ -35,7 +35,6 @@ export async function logActivity(
export async function checkRateLimit(action: string): Promise<{ blocked: boolean, remaining?: number, resetTime?: Date }> {
const MAX_ATTEMPTS = 5
const WINDOW_MINUTES = 10
try {
const supabase = await createAdminClient() || await createClient()