         else
             # Send request to the Data System
             login = req.params.login
-            # Check if an other device hasn't the same name
-            deviceExists login, (err, device) ->
-                if err
-                    next err
-                else if not device
-                    error = new Error "This device doesn't exist"
-                    error.status = 400
-                    next error
-                else
-                    # Remove device
-                    removeDevice device, (err) ->
-                        if err?
-                            next err
-                        else
-                            res.send 200
+
+            checkLogin login, true, (err, device) ->
+                # Remove device
+                removeDevice device, (err) ->
+                    if err?
+                        next err
+                    else
+                        res.send 200
 
     initAuth req, (user) ->
         # Check if request is authenticated

        else
            cb null, body[0]

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



module.exports.remove = (req, res, next) ->

    authenticator = passport.authenticate 'local', (err, user) ->
        if err
