feat: Hide MFA for non-moderators

This commit is contained in:
gpt-engineer-app[bot]
2025-11-01 15:25:40 +00:00
parent 133141d474
commit ed75bbbc9d
2 changed files with 21 additions and 17 deletions

View File

@@ -145,7 +145,7 @@ export function FeaturedParks() {
</div> </div>
<div className="grid md:grid-cols-3 gap-6"> <div className="grid md:grid-cols-3 gap-6">
{topRated.data?.map((park) => ( {topRatedParks.map((park) => (
<FeaturedParkCard <FeaturedParkCard
key={park.id} key={park.id}
park={park} park={park}
@@ -166,7 +166,7 @@ export function FeaturedParks() {
</div> </div>
<div className="grid md:grid-cols-3 gap-6"> <div className="grid md:grid-cols-3 gap-6">
{mostRides.data?.map((park) => ( {mostRidesParks.map((park) => (
<FeaturedParkCard <FeaturedParkCard
key={park.id} key={park.id}
park={park} park={park}

View File

@@ -6,6 +6,7 @@ import { Separator } from '@/components/ui/separator';
import { Badge } from '@/components/ui/badge'; import { Badge } from '@/components/ui/badge';
import { handleError, handleSuccess } from '@/lib/errorHandler'; import { handleError, handleSuccess } from '@/lib/errorHandler';
import { useAuth } from '@/hooks/useAuth'; import { useAuth } from '@/hooks/useAuth';
import { useUserRole } from '@/hooks/useUserRole';
import { Shield, Key, Smartphone, Globe, Loader2, Monitor, Tablet, Trash2 } from 'lucide-react'; import { Shield, Key, Smartphone, Globe, Loader2, Monitor, Tablet, Trash2 } from 'lucide-react';
import { format } from 'date-fns'; import { format } from 'date-fns';
import { Skeleton } from '@/components/ui/skeleton'; import { Skeleton } from '@/components/ui/skeleton';
@@ -28,6 +29,7 @@ import { SessionRevokeConfirmDialog } from './SessionRevokeConfirmDialog';
export function SecurityTab() { export function SecurityTab() {
const { user } = useAuth(); const { user } = useAuth();
const { isModerator } = useUserRole();
const navigate = useNavigate(); const navigate = useNavigate();
const [passwordDialogOpen, setPasswordDialogOpen] = useState(false); const [passwordDialogOpen, setPasswordDialogOpen] = useState(false);
const [identities, setIdentities] = useState<UserIdentity[]>([]); const [identities, setIdentities] = useState<UserIdentity[]>([]);
@@ -370,21 +372,23 @@ export function SecurityTab() {
</Card> </Card>
</div> </div>
{/* Two-Factor Authentication - Full Width */} {/* Two-Factor Authentication - Full Width (Moderators+ Only) */}
<Card> {isModerator() && (
<CardHeader> <Card>
<div className="flex items-center gap-2"> <CardHeader>
<Smartphone className="w-5 h-5" /> <div className="flex items-center gap-2">
<CardTitle>Two-Factor Authentication</CardTitle> <Smartphone className="w-5 h-5" />
</div> <CardTitle>Two-Factor Authentication</CardTitle>
<CardDescription> </div>
Add an extra layer of security to your account with TOTP authentication <CardDescription>
</CardDescription> Add an extra layer of security to your account with TOTP authentication
</CardHeader> </CardDescription>
<CardContent> </CardHeader>
<TOTPSetup /> <CardContent>
</CardContent> <TOTPSetup />
</Card> </CardContent>
</Card>
)}
{/* Active Sessions - Full Width */} {/* Active Sessions - Full Width */}
<Card> <Card>