diff --git a/package-lock.json b/package-lock.json
index d4e3cfbd3905485cac78420d7949c934943522c6..1dba8f4ad69350afd05b810be6b503d9bf3714ec 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -392,11 +392,6 @@
       "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=",
       "dev": true
     },
-    "asap": {
-      "version": "2.0.6",
-      "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz",
-      "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY="
-    },
     "asn1": {
       "version": "0.2.3",
       "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz",
@@ -1446,7 +1441,7 @@
       "integrity": "sha1-QooiOv4DQl0s1tY0f99AxmkDVj0=",
       "optional": true,
       "requires": {
-        "nan": "2.9.1"
+        "nan": "2.9.2"
       }
     },
     "duplexer": {
@@ -2326,7 +2321,7 @@
       "integrity": "sha512-WIr7iDkdmdbxu/Gh6eKEZJL6KPE74/5MEsf2whTOFNxbIoIixogroLdKYqB6FDav4Wavh/lZdzzd3b2KxIXC5Q==",
       "optional": true,
       "requires": {
-        "nan": "2.9.1",
+        "nan": "2.9.2",
         "node-pre-gyp": "0.6.39"
       },
       "dependencies": {
@@ -2860,7 +2855,6 @@
         "os-tmpdir": {
           "version": "1.0.2",
           "bundled": true,
-          "dev": true,
           "optional": true
         },
         "osenv": {
@@ -4075,25 +4069,6 @@
         }
       }
     },
-    "ldapauth-fork": {
-      "version": "4.0.2",
-      "resolved": "https://registry.npmjs.org/ldapauth-fork/-/ldapauth-fork-4.0.2.tgz",
-      "integrity": "sha512-YoPHsyfV6L/4SO5EMi/Jk1xUMaY+ANlR4Yp+WIsqGkWOLPKkuzRYB4s/IsdKBeb3sdwVCw+q/YN9eoa1dXmQdA==",
-      "requires": {
-        "@types/ldapjs": "1.0.3",
-        "@types/node": "7.0.55",
-        "bcryptjs": "2.4.3",
-        "ldapjs": "1.0.2",
-        "lru-cache": "4.1.1"
-      },
-      "dependencies": {
-        "@types/node": {
-          "version": "7.0.55",
-          "resolved": "https://registry.npmjs.org/@types/node/-/node-7.0.55.tgz",
-          "integrity": "sha512-diCxfWNT4g2UM9Y+BPgy4s3egcZ2qOXc0mXLauvbsBUq9SBKQfh0SmuEUEhJVFZt/p6UDsjg1s2EgfM6OSlp4g=="
-        }
-      }
-    },
     "ldapjs": {
       "version": "1.0.2",
       "resolved": "https://registry.npmjs.org/ldapjs/-/ldapjs-1.0.2.tgz",
@@ -4512,9 +4487,9 @@
       }
     },
     "nan": {
-      "version": "2.9.1",
-      "resolved": "https://registry.npmjs.org/nan/-/nan-2.9.1.tgz",
-      "integrity": "sha512-c609vVPyCEuuzqOjx3hwsSZMXLg5QTzbTfgBmEx6N444ymBt1+Yg/rTGr2+4S3VJ3btXI8m1TZ7nLcYcRTZYuQ==",
+      "version": "2.9.2",
+      "resolved": "https://registry.npmjs.org/nan/-/nan-2.9.2.tgz",
+      "integrity": "sha512-ltW65co7f3PQWBDbqVvaU1WtFJUsNW7sWWm4HINhbMQIyVyzIeyZ8toX5TC5eeooE6piZoaEh4cZkueSKG3KYw==",
       "optional": true
     },
     "nanomatch": {
@@ -5786,6 +5761,12 @@
       "integrity": "sha512-EzBtUaFH9bHYPc69wqjp0efJI/DPNHdFbGE3uIMn4sVbO0zx8vZ8cG4WKxQfOpUOKsQyGBiT2mTqnCw+6nLswA==",
       "optional": true
     },
+    "safe-json-stringify": {
+      "version": "1.1.0",
+      "resolved": "https://registry.npmjs.org/safe-json-stringify/-/safe-json-stringify-1.1.0.tgz",
+      "integrity": "sha512-EzBtUaFH9bHYPc69wqjp0efJI/DPNHdFbGE3uIMn4sVbO0zx8vZ8cG4WKxQfOpUOKsQyGBiT2mTqnCw+6nLswA==",
+      "optional": true
+    },
     "safe-regex": {
       "version": "1.1.0",
       "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz",
diff --git a/src/ldap_data.js b/src/ldap_data.js
new file mode 100644
index 0000000000000000000000000000000000000000..f0c194e6ed657c9f3f0967a4f9d03bef38e2b730
--- /dev/null
+++ b/src/ldap_data.js
@@ -0,0 +1,44 @@
+var ensureLoggedin =  require('connect-ensure-login').ensureLoggedIn;
+var ldapescape = require("ldap-escape");
+//var Fuse = require("fuse.js");
+
+var ldap = require('ldapjs');
+
+var client = ldap.createClient({ url: "ldap://frankiz", timeout: 10000, idleTimeout: 10000});
+
+/**
+ * @summary Key function ; interrogates LDAP to get list of groups the person's in
+ * @arg {int} person_id
+ * @return {string} List of groups where the specified user is member
+ */
+function groupsUserIsMember(person_id) {
+    return client.search("ou=groups,dc=frankiz,dc=net", {
+        scope: "one",
+        filter: ldapescape.filter("(|(memberUid=${id})(restrictedMemberUid={$id}))",{id: person_id}),
+        attributes: "uid",
+    },
+        /**
+         * @summary Fonction gestion erreur ; sûrement un truc malin à faire
+         * @arg {Object} err - Code d'erreur
+         * @arg {Object} res - Résultat de la fonction
+         */
+    function(err, res) { return err;
+    /**
+        if (err) {
+            reject("LDAP ");
+        }
+        assert.ifError(err);
+
+        res.on('searchEntry', function(entry) {
+            console.log('entry: ' + JSON.stringify(entry.object));
+        });
+        res.on('searchReference', function(referral) {
+            console.log('referral: ' + referral.uris.join());
+        });
+        res.on('error', function(err) {
+            console.error('error: ' + err.message);
+        });
+        res.on('end', function(result) {
+            console.log('status: ' + result.status);}); */
+    });
+}
\ No newline at end of file
diff --git a/src/talk_ldap_data.js b/src/talk_ldap_data.js
deleted file mode 100644
index be10c96c36611b7126ae6ba97b941d7145506eee..0000000000000000000000000000000000000000
--- a/src/talk_ldap_data.js
+++ /dev/null
@@ -1,161 +0,0 @@
-var ensureLoggedin =  require('connect-ensure-login').ensureLoggedIn;
-var ldapescape = require("ldap-escape");
-var Fuse = require("fuse.js");
-
-/**
- * @summary Fonction de Toussaint
- * @arg {int} uid - L'id à tester
- * @arg {int} from - Le groupe à tester
- * @arg {string} client - Le serveur à tester
- */
-function checkGroupAdmin(uid, from, client){
-    return new Promise(function(resolve, reject) {
-        client.search("dc=frankiz,dc=net", {scope: "sub", attributes: ["cn", "uid", "mail", "memberUid", "objectClass"], filter: ldapescape.filter("(uid=${uid})", {uid: from})}, function(err, resldap){
-            if (err) {
-                reject("LDAP search error");
-            } else {
-                resldap.on('searchEntry', function(entry) {
-                    if (entry.object.objectClass.indexOf("inetOrgPerson") > -1) {
-                        if (entry.object.uid == uid) {
-                            resolve(entry.object.cn + " <" + entry.object.mail + ">");
-                        } else {
-                            reject("Cannot send as user which is not you");
-                        }
-                    } else {
-                        if (entry.object.memberUid.indexOf(uid) > -1) {
-                            resolve(entry.object.cn + " <" + from + "@eleves.polytechnique.fr>");
-                        } else {
-                            reject("You are not admin of this group");
-                        }
-                    }
-                });
-            }
-        });
-    });
-}
-
-module.exports = function(server, passport, ldap, mailqueue, config) {
-    // Create Express API's here
-
-    server.post('/api/auth', passport.authenticate('ldapauth', {failureRedirect: '/'}), function (req, res) {
-        req.session.dn = req.user.dn;
-        req.session.password = req.body.password;
-
-        if (req.session.returnTo !== undefined) {
-            res.redirect(req.session.returnTo);
-        } else {
-            res.redirect("/send");
-        }
-    });
-
-    server.get('/api/logout', function(req, res){
-        req.logout();
-        res.redirect('/');
-    });
-
-    server.get('/api/listfrom', ensureLoggedin(), function(req, res){
-        var client = ldap.createClient({
-            url: config.ldap.server,
-        });
-        client.bind(req.session.dn, req.session.password, function(err){
-            if (err) {
-                console.error("Error binding", err);
-                res.status(500).end("Unable to bind");
-            } else {
-                var out = [{name: req.user.cn, mail: req.user.mail, id: req.user.uid}];
-                client.search("ou=groups,dc=frankiz,dc=net", {scope: "sub", attributes: ["cn", "uid"], filter: ldapescape.filter("(memberUid=${uid})", {uid: req.user.uid})}, function(err, resldap){
-                    if (err) {
-                        console.error(err);
-                    } else {
-                        resldap.on('error', function(err) {
-                            console.error('error: ' + err.message);
-                        });
-
-                        resldap.on('searchEntry', function(entry) {
-                            out.push({name: entry.object.cn, id: entry.object.uid, mail: entry.object.uid + "@eleves.polytechnique.fr"});
-                        });
-
-                        resldap.on('end', function(result) {
-                            res.json(out);
-                        });
-                    }
-                });
-            }
-        });
-
-    });
-
-    server.get('/api/autocomplete/:query', ensureLoggedin(), function(req, res){
-        var client = ldap.createClient({
-            url: config.ldap.server
-        });
-        client.bind(req.session.dn, req.session.password, function(err){
-            if (err) {
-                console.error("Error binding", err);
-                res.status(500).end("Unable to bind");
-            } else {
-                var out = [];
-                client.search("ou=eleves,dc=frankiz,dc=net", {scope: "sub", attributes: ["cn", "uid", "mail"], filter: ldapescape.filter("(|(uid=*${uid}*)(cn=*${uid}*))", {uid: req.params.query})}, function(err, resldap){
-                    if (err) {
-                        console.error(err);
-                    } else {
-                        resldap.on('error', function(err) {
-                            console.error('error: ' + err.message);
-                        });
-
-                        resldap.on('searchEntry', function(entry) {
-                            out.push({label: entry.object.cn, id: entry.object.uid, value: entry.object.mail});
-                        });
-
-                        resldap.on('end', function(result) {
-                            var options = {
-                                shouldSort: true,
-                                threshold: 0.6,
-                                location: 0,
-                                distance: 100,
-                                maxPatternLength: 32,
-                                minMatchCharLength: 1,
-                                keys: ["label", "value"]
-                            };
-
-                            var fuse = new Fuse(out, options);
-
-                            res.json(fuse.search(req.params.query));
-                        });
-                    }
-                });
-            }
-        });
-    });
-
-    server.post('/api/send', ensureLoggedin(), function(req, res){
-        var client = ldap.createClient({
-            url: config.ldap.server 
-        });
-        client.bind(req.session.dn, req.session.password, function(err){
-            if (err) {
-                console.error("Error binding", err);
-                res.status(500).end("Unable to bind");
-            } else {
-                checkGroupAdmin(req.user.uid, req.body.from, client).then(function(sender){
-                    var to = JSON.parse(req.body.to);
-                    console.log(to);
-                    for (var i = 0; i < to.length; i++) {
-                        message = {
-                            from: sender,
-                            to: to[i].value,
-                            subject: req.body.subject,
-                            html: req.body.content
-                        };
-                        mailqueue.push(message);
-                    }
-
-                }, function(error){console.error(error);});
-                res.redirect("/send");
-            }
-        });
-
-    });
-
-
-};