|
26 | 26 |
|
27 | 27 | <hr class="my-4"> |
28 | 28 | {% include 'includes/header_title.html' with pretitle='REST API' title='API key' %} |
29 | | - <form class="mb-5" autocomplete="off"> |
30 | | - <div class="row"> |
31 | | - <div class="col-6"> |
32 | | - <div> |
33 | | - <p> |
34 | | - Your personal API key provides access to the <a href="{% url 'api-docs:docs-index' %}" target="_blank">REST API</a>.<br> |
35 | | - <strong>Treat it like a password and keep it secure.</strong> |
36 | | - </p> |
37 | | - {% if request.user.api_token %} |
38 | | - <div class="alert alert-primary m-0 mb-3" role="alert"> |
39 | | - Your API key <strong>{{ request.user.api_token.prefix }}...</strong> |
40 | | - was generated on {{ request.user.api_token.created }}<br> |
41 | | - For security reasons, the full key is only shown once at generation time.<br> |
42 | | - If you lose it, you will need to regenerate a new one. |
43 | | - </div> |
44 | | - {% else %} |
45 | | - <div class="alert alert-warning m-0 mb-3" role="alert"> |
46 | | - <strong>No API key created.</strong><br> |
47 | | - Generate one using the button below to access the REST API. |
48 | | - </div> |
49 | | - {% endif %} |
50 | | - </div> |
51 | | - <div> |
52 | | - <a href="#" class="btn btn-outline-dark" data-bs-toggle="modal" data-bs-target="#generate-api-key"> |
53 | | - Generate API key |
54 | | - </a> |
55 | | - </div> |
| 29 | + <div class="row"> |
| 30 | + <div class="col-6"> |
| 31 | + <div> |
| 32 | + <p> |
| 33 | + Your personal API key provides access to the <a href="{% url 'api-docs:docs-index' %}" target="_blank">REST API</a>.<br> |
| 34 | + <strong>Treat it like a password and keep it secure.</strong> |
| 35 | + </p> |
| 36 | + {% if request.user.api_token %} |
| 37 | + <div class="alert alert-primary m-0 mb-3" role="alert"> |
| 38 | + Your API key <strong>{{ request.user.api_token.prefix }}...</strong> |
| 39 | + was generated on {{ request.user.api_token.created }}<br> |
| 40 | + For security reasons, the full key is only shown once at generation time.<br> |
| 41 | + If you lose it, you will need to regenerate a new one. |
| 42 | + </div> |
| 43 | + {% else %} |
| 44 | + <div class="alert alert-warning m-0 mb-3" role="alert"> |
| 45 | + <strong>No API key created.</strong><br> |
| 46 | + Generate one using the button below to access the REST API. |
| 47 | + </div> |
| 48 | + {% endif %} |
| 49 | + </div> |
| 50 | + <div> |
| 51 | + <a href="#" class="btn btn-outline-dark" data-bs-toggle="modal" data-bs-target="#generate-api-key"> |
| 52 | + Generate API key |
| 53 | + </a> |
| 54 | + {% if request.user.api_token %} |
| 55 | + <form action="{% url 'revoke_api_key' %}" id="revoke-api-key-form" class="d-inline" method="post">{% csrf_token %} |
| 56 | + <button type="submit" class="btn btn-outline-danger">Revoke API key</button> |
| 57 | + </form> |
| 58 | + {% endif %} |
56 | 59 | </div> |
57 | 60 | </div> |
58 | | - </form> |
| 61 | + </div> |
59 | 62 |
|
60 | 63 | <div class="modal" tabindex="-1" role="dialog" id="generate-api-key"> |
61 | 64 | <div class="modal-dialog" role="document"> |
|
0 commit comments