summaryrefslogtreecommitdiff
path: root/pear/PEAR/Command/Auth.php
diff options
context:
space:
mode:
Diffstat (limited to 'pear/PEAR/Command/Auth.php')
-rw-r--r--pear/PEAR/Command/Auth.php22
1 files changed, 15 insertions, 7 deletions
diff --git a/pear/PEAR/Command/Auth.php b/pear/PEAR/Command/Auth.php
index 1035a1a2de..47f0abf67f 100644
--- a/pear/PEAR/Command/Auth.php
+++ b/pear/PEAR/Command/Auth.php
@@ -87,20 +87,28 @@ password from your user configuration.',
if (empty($username)) {
$username = @$_ENV['USER'];
}
- $this->ui->displayLine("Logging in to $server.");
- $username = trim($this->ui->userDialog('Username', 'text', $username));
-
+ $this->ui->outputData("Logging in to $server.", $command);
+
+ list($username, $password) = $this->ui->userDialog(
+ $command,
+ array('Username', 'Password'),
+ array('text', 'password'),
+ array($username, '')
+ );
+ $username = trim($username);
+ $password = trim($password);
+
$this->config->set('username', $username);
- $password = trim($this->ui->userDialog('Password', 'password'));
$this->config->set('password', $password);
+
$remote->expectError(401);
$ok = $remote->call('logintest');
$remote->popExpect();
if ($ok === true) {
- $this->ui->displayLine("Logged in.");
+ $this->ui->outputData("Logged in.", $command);
$this->config->store();
} else {
- $this->ui->displayLine("Login failed!");
+ return $this->raiseError("Login failed!");
}
}
@@ -122,7 +130,7 @@ password from your user configuration.',
function doLogout($command, $options, $params)
{
$server = $this->config->get('master_server');
- $this->ui->displayLine("Logging out from $server.");
+ $this->ui->outputData("Logging out from $server.", $command);
$this->config->remove('username');
$this->config->remove('password');
$this->config->store();