 
     # Register current device to remote Cozy and then save related informations
     # to the config file
-    addRemote: (url, syncPath, deviceName, callback) =>
-        unless url.match /^https?:\/\//
-            log.warn "Your URL looks invalid: #{url}"
+    addRemote: (cozyUrl, syncPath, deviceName, callback) =>
+        parsed = url.parse cozyUrl
+        parsed.protocol ?= 'https:'
+        cozyUrl = url.format parsed
+        unless parsed.protocol in ['http:', 'https:'] and parsed.hostname
+            log.warn "Your URL looks invalid: #{cozyUrl}"
             callback? err
             return
         deviceName ?= os.hostname() or 'desktop'

async = require 'async'
path  = require 'path-extra'
os    = require 'os'
log   = require('printit')
    prefix: 'Cozy Desktop  '


            @askPassword,
            (password, next) ->
                options =
                    url: cozyUrl
                    deviceName: deviceName
                    password: password
                Devices.registerDevice options, next
