Skip to content

Commit 86ebedb

Browse files
authored
Improve API UI (#6288)
1 parent 55df717 commit 86ebedb

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

warehouse/templates/manage/token.html

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ <h1 class="page-title">{{ title }} <span class="badge badge--warning">Beta featu
3030
{% if serialized_macaroon %}
3131
<section id="provisioned-key">
3232
<h2>Token for "{{ macaroon.description }}"</h2>
33+
<p>
34+
<strong>Permissions:</strong> Upload packages<br>
35+
{% if macaroon.caveats.permissions == "user" %}
36+
<strong>Scope:</strong> Entire account (all projects)
37+
{% else %}
38+
<strong>Scope:</strong> Project "{{ macaroon.caveats.permissions.projects[0] }}"
39+
{% endif %}
40+
</p>
3341
<p>For instructions on how to use this token, <a href="/help#apitoken">visit the PyPI help page</a>.</p>
3442
<code class="api-token">{{ serialized_macaroon }}</code>
3543
<div class="margin-bottom--large">
@@ -60,6 +68,9 @@ <h2>Token for "{{ macaroon.description }}"</h2>
6068

6169
{{ form_error_anchor(create_macaroon_form) }}
6270
<section id="add-token">
71+
{% if serialized_macaroon %}
72+
<h2>Add another token</h2>
73+
{% endif %}
6374
<form method="POST">
6475
<input type="hidden" name="csrf_token" value="{{ request.session.get_csrf_token() }}">
6576
{{ form_errors(create_macaroon_form) }}
@@ -69,11 +80,14 @@ <h2>Token for "{{ macaroon.description }}"</h2>
6980
{{ field_errors(create_macaroon_form.description) }}
7081
<p id="description-help-text" class="form-group__help-text">What is this token for?</p>
7182
</div>
83+
<div class="form-group">
84+
<span class="form-group__label">Permissions</span>
85+
<p class="form-group__text">Upload packages</p>
86+
</div>
7287
<div class="form-group">
7388
<label for="token_scope" class="form-group__label">Scope</label>
7489
<select name="token_scope" id="token_scope" class="form-group__input" aria-describedby="token_scope-errors">
7590
<option disabled selected value="scope:unspecified">Select scope...</option>
76-
<option value="scope:user">Entire account (all projects)</option>
7791
{% for project in project_names %}
7892
<option value="scope:project:{{ project }}">Project: {{ project }}</option>
7993
{% endfor %}

warehouse/templates/pages/help.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ <h3 id="utfdevices">{{ utfdevices() }}</h3>
275275

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

278-
<p>API tokens provide an alternative way (instead of username and password) to authenticate when uploading packages to PyPI.</p>
278+
<p>API tokens provide an alternative way (instead of username and password) to authenticate when <strong>uploading packages</strong> to PyPI.</p>
279279
<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>
280280
<p><strong>We strongly recommend you authenticate with an API token where possible.</strong></p>
281281

0 commit comments

Comments
 (0)