make user URL optional in connect command
[shpub.git] / src / shpub / Command / Connect.php
index b59de5ce10a668bebd91738b87de11af9fd87933..68a4e18e354e26c372e69ab789a9e6e499a2f7ab 100644 (file)
@@ -16,6 +16,14 @@ class Command_Connect
 
     public function run($server, $user, $newKey, $force)
     {
+        $server = Validator::url($server, 'server');
+        if ($user === null) {
+            //indieweb: homepage is your identity
+            $user = $server;
+        } else {
+            $user = Validator::url($user, 'user');
+        }
+
         $host = $this->getHost($newKey != '' ? $newKey : $server, $force);
         if ($host === null) {
             //already taken