33
0
mirror of https://github.com/joomla-extensions/patchtester.git synced 2024-12-22 10:58:58 +00:00

Merge pull request #320 from particthistle/master

4.0 Remove Credentials option for GitHub as it's been phased out.
This commit is contained in:
Roland Dalmulder 2021-05-02 11:34:04 +02:00 committed by GitHub
commit cfa82b43fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 2 additions and 57 deletions

View File

@ -135,27 +135,6 @@ class GitHub
// Get a new Uri object using the API URL and given path.
$uri = new Uri($this->options->get('api.url') . $path);
// Only apply basic authentication if an access token is not set
if ($this->options->get('gh.token', false) === false)
{
// Use basic authentication
if ($this->options->get('api.username', false))
{
$username = $this->options->get('api.username');
$username = str_replace('@', '%40', $username);
$username = str_replace('#', '%23', $username);
$uri->setUser($username);
}
if ($this->options->get('api.password', false))
{
$password = $this->options->get('api.password');
$password = str_replace('@', '%40', $password);
$password = str_replace('#', '%23', $password);
$uri->setPass($password);
}
}
// If we have a defined page number add it to the JUri object.
if ($page > 0)
{

View File

@ -48,12 +48,6 @@ abstract class Helper
{
$options->set('headers', ['Authorization' => 'token ' . $params->get('gh_token', '')]);
}
// Set the username and password if set in the params
elseif ($params->get('gh_user', '') && $params->get('gh_password'))
{
$options->set('api.username', $params->get('gh_user', ''));
$options->set('api.password', $params->get('gh_password', ''));
}
// Display a message about the lowered API limit without credentials
else
{

View File

@ -59,32 +59,9 @@
onchange="jQuery('#jform_gh_user, #jform_gh_password, #jform_gh_token').val('');"
>
<option value="">JNONE</option>
<option value="credentials">COM_PATCHTESTER_FIELD_GH_AUTH_OPTION_CREDENTIALS</option>
<option value="token">COM_PATCHTESTER_FIELD_GH_AUTH_OPTION_TOKEN</option>
</field>
<!-- Note: Default username is a space to avoid browser autocomplete. -->
<field
name="gh_user"
type="text"
label="COM_PATCHTESTER_FIELD_GH_USER_LABEL"
description="COM_PATCHTESTER_FIELD_GH_USER_DESC"
autocomplete="off"
default=" "
showon="gh_auth:credentials"
/>
<field
name="gh_password"
type="password"
label="COM_PATCHTESTER_FIELD_GH_PASSWORD_LABEL"
description="COM_PATCHTESTER_FIELD_GH_PASSWORD_DESC"
hiddenDescription="true"
autocomplete="off"
default=""
showon="gh_auth:credentials"
/>
<field
name="gh_token"
type="text"

View File

@ -44,16 +44,11 @@ COM_PATCHTESTER_FIELD_CI_SERVER_SWITCH="Switch CI Integration"
COM_PATCHTESTER_FIELD_CI_SERVER_SWITCH_DESC="Turn CI integration on or off."
COM_PATCHTESTER_FIELD_CI_SERVER_SWITCH_OPTION_OFF="Off"
COM_PATCHTESTER_FIELD_CI_SERVER_SWITCH_OPTION_ON="On"
COM_PATCHTESTER_FIELD_GH_AUTH_DESC="Select 'Credentials' to use authentication through your GitHub Username and Password, or 'Token' for a GitHub API Token"
COM_PATCHTESTER_FIELD_GH_AUTH_DESC="Select 'Token' for a GitHub API Token"
COM_PATCHTESTER_FIELD_GH_AUTH_LABEL="GitHub Authentication Method"
COM_PATCHTESTER_FIELD_GH_AUTH_OPTION_CREDENTIALS="Credentials"
COM_PATCHTESTER_FIELD_GH_AUTH_OPTION_TOKEN="Token"
COM_PATCHTESTER_FIELD_GH_PASSWORD_DESC="Password for the account entered in the 'GitHub Account Username' field. Note that accounts using Two Factor Authentication will not work with username and password authentication.<p><span class=""alert-danger"">GitHub will discontinue the use of username and password on November 13, 2020 at 4:00 PM UTC. It is highly recommended to use the Token Authentication Method</span></p>"
COM_PATCHTESTER_FIELD_GH_PASSWORD_LABEL="GitHub Account Password"
COM_PATCHTESTER_FIELD_GH_TOKEN_DESC="Use this field to input a GitHub API Token in place of your username and password. Note that this is required if your account has Two Factor Authentication enabled.<p></p>To setup an access token, follow these steps.<ol><li><a href=""https://github.com/settings/tokens/new?description=Joomla%20Patch%20Tester&scopes=public_repo,repo:status"" target=""_blank"">Create a Personal Access Token</a></li><li>Click <span class=""font-weight-bold"">Generate token</span> at the bottom of the page</li><li>At the top in the green bar you will find your access token</li><li>Copy the token by selecting it or clicking on the clipboard</li><li>Paste the token in the <span class=""font-weight-bold"">GitHub Token</span> field above</li><li>Save the changes by clicking the <span class=""font-weight-bold"">Save & Close</span> button at the top</li><li>You can now use the Patch Tester with your token</li></ol><p>You can always revoke access by deleting the Personal access token from the <a href=""https://github.com/settings/tokens"" target=""_blank"">Personal access tokens on Github</a>.</p>"
COM_PATCHTESTER_FIELD_GH_TOKEN_LABEL="GitHub Token"
COM_PATCHTESTER_FIELD_GH_USER_DESC="Name of account on GitHub to use to authenticate to the API."
COM_PATCHTESTER_FIELD_GH_USER_LABEL="GitHub Account Username"
COM_PATCHTESTER_FIELD_ORG_DESC="A username or organisation on GitHub to monitor pull requests for."
COM_PATCHTESTER_FIELD_ORG_LABEL="Custom Project Owner"
COM_PATCHTESTER_FIELD_REPO_DESC="Name of a repository on GitHub to monitor pull requests for."
@ -83,7 +78,7 @@ COM_PATCHTESTER_GITHUB="GitHub"
COM_PATCHTESTER_HEADING_FETCH_DATA="Fetching GitHub Data"
COM_PATCHTESTER_JISSUE="J! Issue"
COM_PATCHTESTER_JISSUES="Issue Tracker"
COM_PATCHTESTER_NO_CREDENTIALS="You have not entered your user credentials in the Options. This will limit you to only 60 requests to the GitHub API per hour. Adding your credentials will allow 5,000 requests per hour."
COM_PATCHTESTER_NO_CREDENTIALS="You have not entered your GitHub API token in the Options. This will limit you to only 60 requests to the GitHub API per hour. Configuring authentication via an API token will allow 5,000 requests per hour."
COM_PATCHTESTER_NO_FILES_TO_PATCH="There are no files to patch from this pull request. This may mean that the files in the pull request are not present in your installation."
COM_PATCHTESTER_NO_ITEMS="No data has been retrieved from GitHub, please click the 'Fetch Data' button in the toolbar to retrieve the open pull requests."
COM_PATCHTESTER_NOT_APPLIED="Not Applied"