1
0
Fork 0

GitLab: clarify interactive auth prompt

pull/9042/head
Stephan 2020-07-15 16:18:21 +01:00
parent d2d3aa8494
commit fb0ad7c900
1 changed files with 8 additions and 3 deletions

View File

@ -104,7 +104,7 @@ class GitLab
}
$this->io->writeError(sprintf('A token will be created and stored in "%s", your password will never be stored', $this->config->getAuthConfigSource()->getName()));
$this->io->writeError('To revoke access to this token you can visit '.$originUrl.'/profile/applications');
$this->io->writeError('To revoke access to this token you can visit '.$scheme.'://'.$originUrl.'/profile/applications');
$attemptCounter = 0;
@ -116,12 +116,17 @@ class GitLab
// 403 is max login attempts exceeded
if (in_array($e->getCode(), array(403, 401))) {
if (401 === $e->getCode()) {
$this->io->writeError('Bad credentials.');
$response = json_decode($e->getResponse(), true);
if (isset($response['error']) && $response['error'] === 'invalid_grant') {
$this->io->writeError('Bad credentials. If you have two factor authentication enabled you will have to manually create a personal access token');
} else {
$this->io->writeError('Bad credentials.');
}
} else {
$this->io->writeError('Maximum number of login attempts exceeded. Please try again later.');
}
$this->io->writeError('You can also manually create a personal token at '.$scheme.'://'.$originUrl.'/profile/personal_access_tokens');
$this->io->writeError('You can also manually create a personal access token enabling the "read_api" scope at '.$scheme.'://'.$originUrl.'/profile/personal_access_tokens');
$this->io->writeError('Add it using "composer config --global --auth gitlab-token.'.$originUrl.' <token>"');
continue;