Skip to content

Improve API UI #6288

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion warehouse/templates/manage/token.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ <h1 class="page-title">{{ title }} <span class="badge badge--warning">Beta featu
{% if serialized_macaroon %}
<section id="provisioned-key">
<h2>Token for "{{ macaroon.description }}"</h2>
<p>
<strong>Permissions:</strong> Upload packages<br>
{% if macaroon.caveats.permissions == "user" %}
<strong>Scope:</strong> Entire account (all projects)
{% else %}
<strong>Scope:</strong> Project "{{ macaroon.caveats.permissions.projects[0] }}"
{% endif %}
</p>
<p>For instructions on how to use this token, <a href="/help#apitoken">visit the PyPI help page</a>.</p>
<code class="api-token">{{ serialized_macaroon }}</code>
<div class="margin-bottom--large">
Expand Down Expand Up @@ -60,6 +68,9 @@ <h2>Token for "{{ macaroon.description }}"</h2>

{{ form_error_anchor(create_macaroon_form) }}
<section id="add-token">
{% if serialized_macaroon %}
<h2>Add another token</h2>
{% endif %}
<form method="POST">
<input type="hidden" name="csrf_token" value="{{ request.session.get_csrf_token() }}">
{{ form_errors(create_macaroon_form) }}
Expand All @@ -69,11 +80,14 @@ <h2>Token for "{{ macaroon.description }}"</h2>
{{ field_errors(create_macaroon_form.description) }}
<p id="description-help-text" class="form-group__help-text">What is this token for?</p>
</div>
<div class="form-group">
<span class="form-group__label">Permissions</span>
<p class="form-group__text">Upload packages</p>
</div>
<div class="form-group">
<label for="token_scope" class="form-group__label">Scope</label>
<select name="token_scope" id="token_scope" class="form-group__input" aria-describedby="token_scope-errors">
<option disabled selected value="scope:unspecified">Select scope...</option>
<option value="scope:user">Entire account (all projects)</option>
{% for project in project_names %}
<option value="scope:project:{{ project }}">Project: {{ project }}</option>
{% endfor %}
Expand Down
2 changes: 1 addition & 1 deletion warehouse/templates/pages/help.html
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ <h3 id="utfdevices">{{ utfdevices() }}</h3>

<h3 id="apitoken">{{ apitoken() }}</h3>

<p>API tokens provide an alternative way (instead of username and password) to authenticate when uploading packages to PyPI.</p>
<p>API tokens provide an alternative way (instead of username and password) to authenticate when <strong>uploading packages</strong> to PyPI.</p>
<p>You can create a token for an entire PyPI account, in which case, the token will work for all projects associated with that account. Alternatively, you can limit a token's scope to a specific project.</p>
<p><strong>We strongly recommend you authenticate with an API token where possible.</strong></p>

Expand Down