Sauvegarde vers le serveur

This commit is contained in:
2026-03-27 14:56:49 +01:00
parent 9fee465f81
commit 23f2136058
10 changed files with 835 additions and 302 deletions

81
public/profile.php Normal file
View File

@@ -0,0 +1,81 @@
<?php
session_start();
$token = $_COOKIE['auth_token'] ?? null;
$userData = [
'login' => 'Guest',
'name' => 'Visiteur',
'email' => 'Non renseigné',
'logged' => false
];
if ($token) {
$parts = explode('.', $token);
if (count($parts) >= 2) {
$payload = json_decode(base64_decode(str_replace(['-', '_'], ['+', '/'], $parts[1])), true);
if ($payload) {
$userData['login'] = preg_replace('/[^a-zA-Z0-9\-\.\@]/', '', $payload['preferred_username'] ?? ($payload['sub'] ?? ''));
$userData['name'] = $payload['name'] ?? 'Utilisateur';
$userData['email'] = $payload['email'] ?? 'Non renseigné';
$userData['logged'] = true;
}
}
}
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<title>Profil - Cloud A5L</title>
<script src="auth.js"></script>
<script src="script.js"></script>
<style>
body { background: #050505; color: white; font-family: 'Segoe UI', sans-serif; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; }
.card { background: #111; border: 1px solid #222; padding: 40px; border-radius: 20px; width: 350px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.avatar { width: 70px; height: 70px; background: #00f2ff; color: #000; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 30px; font-weight: bold; margin: 0 auto 20px; text-transform: uppercase; }
.avatar.guest { background: #333; color: #888; }
h1 { font-size: 1.4rem; margin: 10px 0; }
.email { color: #666; font-size: 0.9rem; margin-bottom: 25px; }
.folder-info { background: #1a1a1a; padding: 15px; border-radius: 10px; text-align: left; border: 1px dashed #333; }
.folder-info label { display: block; font-size: 0.7rem; color: #00f2ff; text-transform: uppercase; margin-bottom: 5px; }
.folder-info code { font-family: monospace; font-size: 0.85rem; color: #ccc; word-break: break-all; }
.btn-login { display: block; width: 100%; background: #00f2ff; color: #000; padding: 15px; border-radius: 12px; border: none; font-weight: bold; margin-top: 20px; cursor: pointer; font-size: 1rem; transition: 0.3s; }
.btn-login:hover { background: #00c8d4; transform: scale(1.02); }
.btn-logout { background: none; border: none; color: #555; cursor: pointer; font-size: 0.8rem; text-decoration: underline; margin-top: 25px; }
.btn-back { display: block; margin-top: 30px; color: #444; text-decoration: none; font-size: 0.9rem; }
</style>
</head>
<body>
<div class="card">
<?php if ($userData['logged']): ?>
<div class="avatar"><?php echo htmlspecialchars(substr($userData['name'], 0, 1)); ?></div>
<h1><?php echo htmlspecialchars($userData['name']); ?></h1>
<div class="email"><?php echo htmlspecialchars($userData['email']); ?></div>
<button onclick="logout()" class="btn-logout">Se déconnecter</button>
<?php else: ?>
<div class="avatar guest">?</div>
<h1>Accès Restreint</h1>
<p style="color: #666; font-size: 0.9rem;">Authentification requise via A5L Identity Provider.</p>
<button onclick="login()" class="btn-login">SE CONNECTER SUR IDP</button>
<?php endif; ?>
<div class="folder-info" style="margin-top: 15px;">
<label>Action Cloud</label>
<button id="syncBtn" onclick="syncAllToCloud()" class="btn-login" style="margin-top:10px; background:#222; color:#00f2ff; border:1px solid #00f2ff;">
☁️ SAUVEGARDER TOUT SUR LE CLOUD
</button>
<div id="syncStatus" style="font-size: 0.7rem; margin-top: 8px; color: #888;"></div>
</div>
<a href="/" class="btn-back">Accueil</a>
</div>
</body>
</html>