X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=modules%2Fprivate%2Fwebsites%2Ftools%2Ftools%2Flanding%2Fldap_ssh_keys.php;fp=modules%2Fprivate%2Fwebsites%2Ftools%2Ftools%2Flanding%2Fldap_ssh_keys.php;h=0000000000000000000000000000000000000000;hb=1a64deeb894dc95e2645a75771732c6cc53a79ad;hp=259e28d1ac9e39366b1a672963cbf3f20a433787;hpb=fa25ffd4583cc362075cd5e1b4130f33306103f0;p=perso%2FImmae%2FConfig%2FNix.git
diff --git a/modules/private/websites/tools/tools/landing/ldap_ssh_keys.php b/modules/private/websites/tools/tools/landing/ldap_ssh_keys.php
deleted file mode 100644
index 259e28d..0000000
--- a/modules/private/websites/tools/tools/landing/ldap_ssh_keys.php
+++ /dev/null
@@ -1,348 +0,0 @@
-
-
-
-
-
Gestion des clés SSH
- $apps,
- 'public_key' => $publicKey,
- 'comment' => $comment,
- ];
- }
-
- return $keys;
-}
-
-function pushLdapInfos($keys)
-{
- $con = doConnect();
- if (!isset($_SESSION["user_dn"]))
- return false;
-
- return ldap_mod_replace($con, $_SESSION["user_dn"], array("immaeSshKey" => $keys));
-}
-
-
-// Script
-if (isset($_POST['deconnexion'])) {
- $_SESSION = [];
-}
-
-if (isset($_POST['sauvegarder'])) {
- $editedKeys = [];
- $errors = false;
- $keysToSave = [];
- foreach($_POST['keys'] as $id => $key) {
- $editedKeys[$id] = $key;
- if (!checkSshKey($key['public_key'])) {
- $editedKeys[$id]['error'] = true;
- $errors = true;
- }
-
- if (!isset($key['apps'])) {
- $editedKeys[$id]['apps'] = $key['apps'] = [];
-
- }
- foreach ($key['apps'] as $app) {
- if (!in_array($app, apps)) {
- die("integrity");
- }
- }
-
- if (!isset($editedKeys[$id]['error']) || $editedKeys[$id]['error'] !== true) {
- $keysToSave[] = implode('|', $key['apps']) . ' ' . $key['public_key'] . ' ' . $key['comment'];
- }
- }
-
- if (!$errors) {
- $successSave = pushLdapInfos($keysToSave);
- }
-}
-
-$loginErrors = "";
-if (isset($_POST['login'])) {
- if (empty($_POST['username']) || empty($_POST['password'])) {
- $loginErrors = "Le nom d'utilisateur et le mot de passe sont requis.";
- } elseif (!checkLogin($_POST['username'], $_POST['password'])) {
- $loginErrors = "Identifiants incorrects.";
- } else {
- $_SESSION['login'] = $_POST['username'];
- }
-}
-
-if (isUserLogged()) :
- $keys = isset($editedKeys) ? $editedKeys : getLdapInfo();
-?>
-
Connecté en tant que = $_SESSION['login']; ?>
-
-
-
-
-
Clés enregistrées avec succès.
-
-
-
-
-
-
-
-
-
-
-
-