From ebb6a82099cc8b97765ecca627c5bc4ff8b0315b Mon Sep 17 00:00:00 2001 From: Derek Stephen McLean Date: Tue, 6 Feb 2024 16:53:18 +0100 Subject: [PATCH] issue #11811 auth token links on separate lines (#11812) * issue #11811 auth token links on separate lines * 11811 - remove stray bracket * 11811 : links on separte lines --- src/Composer/Util/Bitbucket.php | 3 ++- src/Composer/Util/GitHub.php | 6 ++++-- src/Composer/Util/GitLab.php | 14 +++++++++++--- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/Composer/Util/Bitbucket.php b/src/Composer/Util/Bitbucket.php index 1c9eeb65d..2be4a815c 100644 --- a/src/Composer/Util/Bitbucket.php +++ b/src/Composer/Util/Bitbucket.php @@ -143,7 +143,8 @@ class Bitbucket $localAuthConfig = $this->config->getLocalAuthConfigSource(); $url = 'https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/'; - $this->io->writeError(sprintf('Follow the instructions on %s', $url)); + $this->io->writeError('Follow the instructions here:'); + $this->io->writeError($url); $this->io->writeError(sprintf('to create a consumer. It will be stored in "%s" for future use by Composer.', ($localAuthConfig !== null ? $localAuthConfig->getName() . ' OR ' : '') . $this->config->getAuthConfigSource()->getName())); $this->io->writeError('Ensure you enter a "Callback URL" (http://example.com is fine) or it will not be possible to create an Access Token (this callback url will not be used by composer)'); diff --git a/src/Composer/Util/GitHub.php b/src/Composer/Util/GitHub.php index 43a635450..3574e5183 100644 --- a/src/Composer/Util/GitHub.php +++ b/src/Composer/Util/GitHub.php @@ -92,12 +92,14 @@ class GitHub $note .= ' ' . date('Y-m-d Hi'); $url = 'https://'.$originUrl.'/settings/tokens/new?scopes=&description=' . str_replace('%20', '+', rawurlencode($note)); - $this->io->writeError(sprintf('When working with _public_ GitHub repositories only, head to %s to retrieve a token.', $url)); + $this->io->writeError('When working with _public_ GitHub repositories only, head here to retrieve a token:'); + $this->io->writeError($url); $this->io->writeError('This token will have read-only permission for public information only.'); $localAuthConfig = $this->config->getLocalAuthConfigSource(); $url = 'https://'.$originUrl.'/settings/tokens/new?scopes=repo&description=' . str_replace('%20', '+', rawurlencode($note)); - $this->io->writeError(sprintf('When you need to access _private_ GitHub repositories as well, go to %s', $url)); + $this->io->writeError('When you need to access _private_ GitHub repositories as well, go to:'); + $this->io->writeError($url); $this->io->writeError('Note that such tokens have broad read/write permissions on your behalf, even if not needed by Composer.'); $this->io->writeError(sprintf('Tokens will be stored in plain text in "%s" for future use by Composer.', ($localAuthConfig !== null ? $localAuthConfig->getName() . ' OR ' : '') . $this->config->getAuthConfigSource()->getName())); $this->io->writeError('For additional information, check https://getcomposer.org/doc/articles/authentication-for-private-packages.md#github-oauth'); diff --git a/src/Composer/Util/GitLab.php b/src/Composer/Util/GitLab.php index 40b0fec00..e5985c2db 100644 --- a/src/Composer/Util/GitLab.php +++ b/src/Composer/Util/GitLab.php @@ -126,9 +126,16 @@ class GitLab } $localAuthConfig = $this->config->getLocalAuthConfigSource(); + $personalAccessTokenLink = $scheme.'://'.$originUrl.'/-/profile/personal_access_tokens'; + $revokeLink = $scheme.'://'.$originUrl.'/-/profile/applications'; $this->io->writeError(sprintf('A token will be created and stored in "%s", your password will never be stored', ($localAuthConfig !== null ? $localAuthConfig->getName() . ' OR ' : '') . $this->config->getAuthConfigSource()->getName())); - $this->io->writeError('To revoke access to this token you can visit '.$scheme.'://'.$originUrl.'/-/profile/applications'); - $this->io->writeError('Alternatively you can setup an personal access token on '.$scheme.'://'.$originUrl.'/-/profile/personal_access_tokens and store it under "gitlab-token" see https://getcomposer.org/doc/articles/authentication-for-private-packages.md#gitlab-token for more details.'); + $this->io->writeError('To revoke access to this token you can visit:'); + $this->io->writeError($revokeLink); + $this->io->writeError('Alternatively you can setup an personal access token on:'); + $this->io->writeError($personalAccessTokenLink); + $this->io->writeError('and store it under "gitlab-token" see https://getcomposer.org/doc/articles/authentication-for-private-packages.md#gitlab-token for more details.'); + $this->io->writeError('https://getcomposer.org/doc/articles/authentication-for-private-packages.md#gitlab-token'); + $this->io->writeError('for more details.'); $storeInLocalAuthConfig = false; if ($localAuthConfig !== null) { @@ -155,7 +162,8 @@ class GitLab $this->io->writeError('Maximum number of login attempts exceeded. Please try again later.'); } - $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('You can also manually create a personal access token enabling the "read_api" scope at:'); + $this->io->writeError($scheme.'://'.$originUrl.'/profile/personal_access_tokens'); $this->io->writeError('Add it using "composer config --global --auth gitlab-token.'.$originUrl.' "'); continue;