Browse Source

Split non-interactive and bad credential cases

Jordi Boggiano 11 years ago
parent
commit
f3c112e9e0
1 changed files with 6 additions and 2 deletions
  1. 6 2
      src/Composer/Util/RemoteFilesystem.php

+ 6 - 2
src/Composer/Util/RemoteFilesystem.php

@@ -324,8 +324,8 @@ class RemoteFilesystem
                 return;
             }
 
-            // fail if we already have auth or the console is not interactive
-            if (!$this->io->isInteractive() || $this->io->hasAuthentication($this->originUrl)) {
+            // fail if the console is not interactive
+            if (!$this->io->isInteractive()) {
                 if ($httpStatus === 401) {
                     $message = "The '" . $this->fileUrl . "' URL required authentication.\nYou must be using the interactive console to authenticate";
                 }
@@ -335,6 +335,10 @@ class RemoteFilesystem
 
                 throw new TransportException($message, $httpStatus);
             }
+            // fail if we already have auth
+            if ($this->io->hasAuthentication($this->originUrl)) {
+                throw new TransportException("Invalid credentials for '" . $this->fileUrl . "', aborting.", $httpStatus);
+            }
 
             $this->io->overwrite('    Authentication required (<info>'.parse_url($this->fileUrl, PHP_URL_HOST).'</info>):');
             $username = $this->io->ask('      Username: ');