Canlıya alınan hatalar düzeltildi.
This commit is contained in:
@@ -6,7 +6,6 @@ import { OTPTemplate } from "@/components/emails/otp-template"
|
|||||||
import { verifyCaptcha } from "@/lib/captcha"
|
import { verifyCaptcha } from "@/lib/captcha"
|
||||||
import { checkRateLimit, incrementRateLimit, logActivity } from '@/lib/security'
|
import { checkRateLimit, incrementRateLimit, logActivity } from '@/lib/security'
|
||||||
import { cookies } from "next/headers"
|
import { cookies } from "next/headers"
|
||||||
import { redirect } from "next/navigation"
|
|
||||||
|
|
||||||
import { compare } from 'bcryptjs'
|
import { compare } from 'bcryptjs'
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export default function VerifyPage() {
|
|||||||
const [isLoading, setIsLoading] = useState(false)
|
const [isLoading, setIsLoading] = useState(false)
|
||||||
const [isResending, setIsResending] = useState(false)
|
const [isResending, setIsResending] = useState(false)
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const captchaRef = useRef<any>(null)
|
const captchaRef = useRef<{ reset: () => void }>(null)
|
||||||
|
|
||||||
const handleVerify = async (e: React.FormEvent) => {
|
const handleVerify = async (e: React.FormEvent) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ import { createClient } from "@/lib/supabase/server"
|
|||||||
import { revalidatePath } from "next/cache"
|
import { revalidatePath } from "next/cache"
|
||||||
|
|
||||||
import { logAction } from "@/lib/logger"
|
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) {
|
export async function addPayment(reservationId: string, formData: FormData) {
|
||||||
const supabase = await createClient()
|
const supabase = await createClient()
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ import { createClient } from "@/lib/supabase/server"
|
|||||||
import { revalidatePath } from "next/cache"
|
import { revalidatePath } from "next/cache"
|
||||||
import { redirect } from "next/navigation"
|
import { redirect } from "next/navigation"
|
||||||
import { logAction } from "@/lib/logger"
|
import { logAction } from "@/lib/logger"
|
||||||
import { sendEmail } from "@/lib/email"
|
|
||||||
import { ReservationCreatedTemplate } from "@/components/emails/reservation-created-template"
|
|
||||||
|
|
||||||
export async function createReservation(data: {
|
export async function createReservation(data: {
|
||||||
hall_id: string
|
hall_id: string
|
||||||
|
|||||||
@@ -14,14 +14,14 @@ import { Badge } from "@/components/ui/badge"
|
|||||||
import { Button } from "@/components/ui/button"
|
import { Button } from "@/components/ui/button"
|
||||||
|
|
||||||
interface LogTabsProps {
|
interface LogTabsProps {
|
||||||
auditLogs: any[]
|
auditLogs: Record<string, unknown>[]
|
||||||
securityLogs: any[]
|
securityLogs: Record<string, unknown>[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export function LogTabs({ auditLogs, securityLogs }: LogTabsProps) {
|
export function LogTabs({ auditLogs, securityLogs }: LogTabsProps) {
|
||||||
const [activeTab, setActiveTab] = useState<'business' | 'security'>('business')
|
const [activeTab, setActiveTab] = useState<'business' | 'security'>('business')
|
||||||
|
|
||||||
const getSecurityBadgeColor = (type: string) => {
|
const getSecurityBadgeColor = (type: string): "default" | "destructive" | "secondary" | "outline" => {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'login_success': return 'default'
|
case 'login_success': return 'default'
|
||||||
case 'login_failed': return 'destructive'
|
case 'login_failed': return 'destructive'
|
||||||
@@ -79,7 +79,8 @@ export function LogTabs({ auditLogs, securityLogs }: LogTabsProps) {
|
|||||||
</TableRow>
|
</TableRow>
|
||||||
</TableHeader>
|
</TableHeader>
|
||||||
<TableBody>
|
<TableBody>
|
||||||
{auditLogs?.map((log) => (
|
{/* eslint-disable-next-line @typescript-eslint/no-explicit-any */}
|
||||||
|
{auditLogs?.map((log: any) => (
|
||||||
<TableRow key={log.id}>
|
<TableRow key={log.id}>
|
||||||
<TableCell>{new Date(log.created_at).toLocaleString('tr-TR')}</TableCell>
|
<TableCell>{new Date(log.created_at).toLocaleString('tr-TR')}</TableCell>
|
||||||
<TableCell className="font-medium">{log.action}</TableCell>
|
<TableCell className="font-medium">{log.action}</TableCell>
|
||||||
@@ -121,11 +122,12 @@ export function LogTabs({ auditLogs, securityLogs }: LogTabsProps) {
|
|||||||
</TableRow>
|
</TableRow>
|
||||||
</TableHeader>
|
</TableHeader>
|
||||||
<TableBody>
|
<TableBody>
|
||||||
{securityLogs?.map((log) => (
|
{/* eslint-disable-next-line @typescript-eslint/no-explicit-any */}
|
||||||
|
{securityLogs?.map((log: any) => (
|
||||||
<TableRow key={log.id}>
|
<TableRow key={log.id}>
|
||||||
<TableCell>{new Date(log.created_at).toLocaleString('tr-TR')}</TableCell>
|
<TableCell>{new Date(log.created_at).toLocaleString('tr-TR')}</TableCell>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
<Badge variant={getSecurityBadgeColor(log.event_type) as any}>
|
<Badge variant={getSecurityBadgeColor(log.event_type)}>
|
||||||
{formatSecurityEvent(log.event_type)}
|
{formatSecurityEvent(log.event_type)}
|
||||||
</Badge>
|
</Badge>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { createHmac, randomBytes } from 'crypto'
|
import { createHmac } from 'crypto'
|
||||||
|
|
||||||
export interface CaptchaData {
|
export interface CaptchaData {
|
||||||
image: string // SVG string
|
image: string // SVG string
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ export type SecurityEventType = 'login_success' | 'login_failed' | 'otp_sent' |
|
|||||||
export async function logActivity(
|
export async function logActivity(
|
||||||
userId: string | null,
|
userId: string | null,
|
||||||
eventType: SecurityEventType,
|
eventType: SecurityEventType,
|
||||||
details: Record<string, any> = {}
|
details: Record<string, unknown> = {}
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
// Use Admin Client to bypass RLS for inserting logs
|
// 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 }> {
|
export async function checkRateLimit(action: string): Promise<{ blocked: boolean, remaining?: number, resetTime?: Date }> {
|
||||||
const MAX_ATTEMPTS = 5
|
const MAX_ATTEMPTS = 5
|
||||||
const WINDOW_MINUTES = 10
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const supabase = await createAdminClient() || await createClient()
|
const supabase = await createAdminClient() || await createClient()
|
||||||
|
|||||||
Reference in New Issue
Block a user