|
20 | 20 | {{ oidc_title() }} |
21 | 21 | {% endblock %} |
22 | 22 |
|
23 | | -{% block main %} |
24 | | -{% if testPyPI %} |
25 | | -{% set title = "TestPyPI" %} |
26 | | -{% else %} |
27 | | -{% set title = "PyPI" %} |
28 | | -{% endif %} |
29 | | - |
30 | | -<div class="horizontal-section"> |
31 | | - <div class="site-container"> |
32 | | - <h1 class="page-title">{{ oidc_title() }}</h1> |
33 | | - |
34 | | - {{ oidc_desc() }} |
35 | | - |
36 | | - <h2>{% trans %}Manage current publishers{% endtrans %}</h2> |
37 | | - {% if project.oidc_publishers %} |
38 | | - <table class="table table--publisher-list"> |
39 | | - <caption class="sr-only"> |
40 | | - {% trans project_name=project.name %}OpenID Connect publishers associated with {{ project_name }}{% endtrans %} |
41 | | - </caption> |
42 | | - <thead> |
43 | | - <tr> |
44 | | - <th scope="col">{% trans %}Publisher{% endtrans %}</th> |
45 | | - <th scope="col">{% trans %}Repository{% endtrans %}</th> |
46 | | - <th scope="col">{% trans %}Workflow{% endtrans %}</th> |
47 | | - <th scope="col">{% trans %}Environment name{% endtrans %}</th> |
48 | | - <th></th> |
49 | | - </tr> |
50 | | - </thead> |
51 | | - <tbody> |
52 | | - {% for publisher in project.oidc_publishers %} |
53 | | - {{ oidc_publisher_row(publisher) }} |
54 | | - {% endfor %} |
55 | | - </tbody> |
56 | | - </table> |
57 | | - {% else %} |
58 | | - <p class="no-bottom-padding">{% trans %}No publishers are currently configured.{% endtrans %}</p> |
59 | | - {% endif %} |
60 | | - |
61 | | - <h2 class="no-bottom-padding">{% trans %}Add a new publisher{% endtrans %}</h2> |
62 | | - {% if request.user.has_two_factor %} |
63 | | - <h3>GitHub</h3> |
64 | | - |
| 23 | +{% macro github_form(request, github_publisher_form) %} |
65 | 24 | <p> |
66 | 25 | {% trans href="https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect" %} |
67 | 26 | Read more about GitHub Actions's OpenID Connect support <a href="{{ href }}">here</a>. |
@@ -146,7 +105,64 @@ <h3>GitHub</h3> |
146 | 105 | <input type="submit" value="{% trans %}Add{% endtrans %}" class="button button--primary"> |
147 | 106 | </div> |
148 | 107 | </form> |
| 108 | +{% endmacro %} |
| 109 | + |
| 110 | +{% block main %} |
| 111 | +{% if testPyPI %} |
| 112 | +{% set title = "TestPyPI" %} |
| 113 | +{% else %} |
| 114 | +{% set title = "PyPI" %} |
| 115 | +{% endif %} |
149 | 116 |
|
| 117 | +<div class="horizontal-section"> |
| 118 | + <div class="site-container"> |
| 119 | + <h1 class="page-title">{{ oidc_title() }}</h1> |
| 120 | + |
| 121 | + {{ oidc_desc() }} |
| 122 | + |
| 123 | + <h2>{% trans %}Manage current publishers{% endtrans %}</h2> |
| 124 | + {% if project.oidc_publishers %} |
| 125 | + <table class="table table--publisher-list"> |
| 126 | + <caption class="sr-only"> |
| 127 | + {% trans project_name=project.name %}OpenID Connect publishers associated with {{ project_name }}{% endtrans %} |
| 128 | + </caption> |
| 129 | + <thead> |
| 130 | + <tr> |
| 131 | + <th scope="col">{% trans %}Publisher{% endtrans %}</th> |
| 132 | + <th scope="col">{% trans %}Details{% endtrans %}</th> |
| 133 | + <th></th> |
| 134 | + </tr> |
| 135 | + </thead> |
| 136 | + <tbody> |
| 137 | + {% for publisher in project.oidc_publishers %} |
| 138 | + {{ oidc_publisher_row(publisher) }} |
| 139 | + {% endfor %} |
| 140 | + </tbody> |
| 141 | + </table> |
| 142 | + {% else %} |
| 143 | + <p class="no-bottom-padding">{% trans %}No publishers are currently configured.{% endtrans %}</p> |
| 144 | + {% endif %} |
| 145 | + |
| 146 | + <h2 class="no-bottom-padding">{% trans %}Add a new publisher{% endtrans %}</h2> |
| 147 | + |
| 148 | + {% if request.user.has_two_factor %} |
| 149 | + |
| 150 | + {% set publishers = [("GitHub", github_form(request, github_publisher_form))] %} |
| 151 | + |
| 152 | + <div class="horizontal-tabs" data-controller="horizontal-tabs" data-horizontal-tabs-index="0"> |
| 153 | + <div class="horizontal-tabs__tabbar"> |
| 154 | + {% for publisher_name, _ in publishers %} |
| 155 | + <button data-horizontal-tabs-target="tab" data-action="horizontal-tabs#change" class="tab {{ "is-active" if loop.first else "" }}"> |
| 156 | + {{ publisher_name }} |
| 157 | + </button> |
| 158 | + {% endfor %} |
| 159 | + </div> |
| 160 | + {% for _, publisher_form in publishers %} |
| 161 | + <div class="horizontal-tabs__tabcontent {{ "is-hidden" if loop.first else "" }}" data-horizontal-tabs-target="tabPanel"> |
| 162 | + {{ publisher_form }} |
| 163 | + </div> |
| 164 | + {% endfor %} |
| 165 | + </div> |
150 | 166 | {% else %}{# user has not enabled 2FA #} |
151 | 167 | <div class="callout-block callout-block--warning"> |
152 | 168 | {% trans href=request.route_path('manage.account.two-factor') %} |
|
0 commit comments