Refactor: Simplify CAPTCHA bypass logic

This commit is contained in:
gpt-engineer-app[bot]
2025-10-11 00:47:34 +00:00
parent 21acbb948c
commit 3f08dcb203
4 changed files with 10 additions and 76 deletions

View File

@@ -24,8 +24,7 @@ export default function AdminSettings() {
error,
updateSetting,
isUpdating,
getSettingsByCategory,
getCaptchaBypassEnabled
getSettingsByCategory
} = useAdminSettings();
if (roleLoading || isLoading) {
@@ -436,15 +435,11 @@ export default function AdminSettings() {
</div>
<Tabs defaultValue="moderation" className="space-y-6">
<TabsList className="grid w-full grid-cols-6">
<TabsList className="grid w-full grid-cols-5">
<TabsTrigger value="moderation" className="flex items-center gap-2">
<Shield className="w-4 h-4" />
<span className="hidden sm:inline">Moderation</span>
</TabsTrigger>
<TabsTrigger value="auth" className="flex items-center gap-2">
<Lock className="w-4 h-4" />
<span className="hidden sm:inline">Auth</span>
</TabsTrigger>
<TabsTrigger value="user_management" className="flex items-center gap-2">
<Users className="w-4 h-4" />
<span className="hidden sm:inline">Users</span>
@@ -493,50 +488,6 @@ export default function AdminSettings() {
</Card>
</TabsContent>
<TabsContent value="auth">
<Card>
<CardHeader>
<CardTitle className="flex items-center gap-2">
<Lock className="w-5 h-5" />
Authentication Settings
</CardTitle>
<CardDescription>
Configure authentication security, CAPTCHA, and login settings
</CardDescription>
</CardHeader>
<CardContent className="space-y-4">
{getCaptchaBypassEnabled() && (
<Card className="bg-yellow-50 dark:bg-yellow-900/20 border-yellow-300">
<CardContent className="pt-6">
<div className="flex items-start gap-3">
<AlertTriangle className="w-5 h-5 text-yellow-600 dark:text-yellow-400 mt-0.5" />
<div className="space-y-1">
<p className="font-medium text-yellow-800 dark:text-yellow-200">
CAPTCHA Bypass is Currently Enabled
</p>
<p className="text-sm text-yellow-700 dark:text-yellow-300">
Authentication requests will not require CAPTCHA verification.
This should ONLY be enabled in development environments.
</p>
</div>
</div>
</CardContent>
</Card>
)}
{getSettingsByCategory('auth').length > 0 ? (
getSettingsByCategory('auth').map((setting) => (
<SettingInput key={setting.id} setting={setting} />
))
) : (
<div className="text-center py-8 text-muted-foreground">
<Lock className="w-12 h-12 mx-auto mb-4 opacity-50" />
<p>No authentication settings configured yet.</p>
</div>
)}
</CardContent>
</Card>
</TabsContent>
<TabsContent value="user_management">
<Card>
<CardHeader>