Repository Public
1/**2 * =============================================================================3 * SP BOUCHER | INFRASTRUCTURE & AUTOMATION4 * ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5 * =============================================================================6 *7 * Project : SPB Private Cloud8 * File : app/dashboard/security/page.tsx9 * Module : app10 * Repository : https://git.spboucher.ai/spb-cloud11 * Project Website : https://cloud.spboucher.ai12 * Created : 2026-09-0713 * Last Modified : 2026-09-0714 *15 * Author : Simon-Pierre Boucher16 * Position : Professor of Finance17 * Institution : Université du Québec en Outaouais (UQO)18 * Organization : SP Boucher19 * Website : https://spboucher.ai20 * Git : https://git.spboucher.ai21 *22 * Preferred Contact: admin@spboucher.ai23 * Technical Contact: dev@spboucher.ai24 * Security/Admin : admin@spboucher.ai25 *26 * Copyright (c) 202627 * Simon-Pierre Boucher28 * All rights reserved where applicable. This file is governed by the29 * applicable project license, copyright notices and relevant law.30 * Existing third-party rights and notices remain unaffected.31 *32 * License : None specified (no license file in this repository)33 *34 * Do not embed credentials, private keys, access tokens,35 * certificates or confidential personal information.36 *37 * =============================================================================38 * END OF SP BOUCHER SOURCE HEADER39 * =============================================================================40 */4142"use client";4344import { useEffect, useState } from "react";45import AppShell from "@/components/layout/AppShell";46import DevicesPanel from "@/components/auth/DevicesPanel";47import TwoFactorSetup from "@/components/admin/TwoFactorSetup";48import ChangePasswordModal from "@/components/auth/ChangePasswordModal";49import PageHeader from "@/components/ui/PageHeader";50import Button from "@/components/ui/Button";51import PageTransition from "@/components/ui/PageTransition";52import { Shield, KeyRound, Monitor } from "lucide-react";5354export default function SecurityPage() {55 const [twoFactorEnabled, setTwoFactorEnabled] = useState(false);56 const [showChangePassword, setShowChangePassword] = useState(false);5758 const fetchStatus = async () => {59 try {60 const res = await fetch("/api/auth/session");61 if (res.ok) {62 const data = await res.json();63 setTwoFactorEnabled(!!data.twoFactorEnabled);64 }65 } catch {}66 };6768 useEffect(() => { fetchStatus(); }, []);6970 return (71 <AppShell>72 <PageTransition className="px-4 lg:px-6 pb-8 max-w-5xl">73 <PageHeader74 title="Sécurité"75 subtitle="Mot de passe, double authentification et appareils connectés"76 icon={Shield}77 tone="text-emerald-600 bg-emerald-500/10 dark:text-emerald-400"78 actions={79 <Button variant="secondary" size="sm" onClick={() => setShowChangePassword(true)}>80 <KeyRound className="w-4 h-4" /> <span className="hidden sm:inline">Changer le mot de passe</span><span className="sm:hidden">Mot de passe</span>81 </Button>82 }83 />8485 <div className="space-y-6">86 <TwoFactorSetup enabled={twoFactorEnabled} onStatusChange={fetchStatus} />8788 <section className="card p-4 sm:p-5">89 <div className="flex items-center gap-3 mb-5">90 <div className="w-10 h-10 rounded-2xl bg-blue-500/10 text-blue-600 dark:text-blue-300 flex items-center justify-center shrink-0">91 <Monitor className="w-5 h-5" />92 </div>93 <div>94 <h2 className="text-[15px] font-semibold text-gray-900 dark:text-white">Appareils et sessions</h2>95 <p className="text-[13px] text-gray-500 dark:text-gray-400">IP, localisation et navigateur enregistrés à chaque connexion.</p>96 </div>97 </div>98 <DevicesPanel />99 </section>100 </div>101 </PageTransition>102 <ChangePasswordModal isOpen={showChangePassword} onClose={() => setShowChangePassword(false)} />103 </AppShell>104 );105}106