 ## @callback {function} Continuation to pass control back to when complete.
 ## Check if application is proxy
 ## Useful for register and login requests
-module.exports.checkProxy = (auth, callback) ->
+module.exports.checkProxyHome = (auth, callback) ->
     if process.env.NODE_ENV is "production"
         if auth isnt "undefined" and auth?
             # Recover username and password in field authorization

        password = auth.split(':')[1]
        # Check if application is well authenticated
        if password isnt undefined and tokens[username] is password
            console.log("application " + username + " is authenticated")
            callback null, true, username
        else
            console.log("Wrong authentication")
            console.log("Token expected : " + tokens[username])
            console.log("Token received : " + password)
            callback null, false, username
    else
        console.log "Warning : application is not authenticated : no field " +
            "authorization"
        callback null, false, null



            password = auth.split(':')[1]
            # Check if application is cozy-proxy
            if password isnt undefined and tokens[username] is password
                if username is "proxy" or username is "home"
                    callback null, true
                else
                    callback null, false
            else
                callback null, false
        else
            callback null, false
    else
        callback null, null
