 
 
 module.exports.remove = (req, res, next) ->
-    # Remove device :
-    #       * remove device access
-    #       * remove device document
-    removeDevice = (device, cb) =>
-        id = device.id
-        # Remove Access
-        clientDS.del "access/#{id}/", (err, result, body) ->
-            if err?
-                error = new Error err
-                error.status = 400
-                cd error
-            else
-                # Remove Device
-                clientDS.del "data/#{id}/", (err, result, body) ->
-                    if err?
-                        error = new Error err
-                        error.status = 400
-                        cd error
-                    else
-                        cb null
 
     authenticator = passport.authenticate 'local', (err, user) ->
         if err

        else
            cb null, body[0]

initAuth = (req, cb) ->
    # Authenticate the request
    [username, password] = extractCredentials req.headers['authorization']

            error.status = 401
            next error
        else
            # Check if name is correctly declared and device doesn't exist
            device = req.body
            checkLogin device.login, false, (err) ->
                return next err if err?
                # Create device
                device.docType = "Device"
                createDevice device, (err, data) ->
                    if err?
                        next err
                    else
                        res.send 201, data


    initAuth req, (user) ->
