mirror of
https://github.com/netbox-community/netbox.git
synced 2025-12-15 04:49:36 -06:00
Toggle plaintext display for v1 tokens
This commit is contained in:
parent
adce67a7cf
commit
f6290dd7af
@ -1,62 +1,8 @@
|
|||||||
{% extends 'generic/object.html' %}
|
{% extends 'users/token.html' %}
|
||||||
{% load form_helpers %}
|
|
||||||
{% load helpers %}
|
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% load plugins %}
|
|
||||||
|
|
||||||
{% block breadcrumbs %}
|
{% block breadcrumbs %}
|
||||||
<li class="breadcrumb-item"><a href="{% url 'account:usertoken_list' %}">{% trans "My API Tokens" %}</a></li>
|
<li class="breadcrumb-item">
|
||||||
|
<a href="{% url 'account:usertoken_list' %}">{% trans "My API Tokens" %}</a>
|
||||||
|
</li>
|
||||||
{% endblock breadcrumbs %}
|
{% endblock breadcrumbs %}
|
||||||
|
|
||||||
{% block title %}{% trans "Token" %} {{ object }}{% endblock %}
|
|
||||||
|
|
||||||
{% block subtitle %}{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
<div class="row">
|
|
||||||
<div class="col col-md-12">
|
|
||||||
<div class="card">
|
|
||||||
<h2 class="card-header">{% trans "Token" %}</h2>
|
|
||||||
<table class="table table-hover attr-table">
|
|
||||||
<tr>
|
|
||||||
<th scope="row">{% trans "Key" %}</th>
|
|
||||||
<td>
|
|
||||||
{% if key %}
|
|
||||||
<div class="float-end">
|
|
||||||
{% copy_content "token_id" %}
|
|
||||||
</div>
|
|
||||||
<div id="token_id">{{ key }}</div>
|
|
||||||
{% else %}
|
|
||||||
{{ object.partial }}
|
|
||||||
{% endif %}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="row">{% trans "Description" %}</th>
|
|
||||||
<td>{{ object.description|placeholder }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="row">{% trans "Write enabled" %}</th>
|
|
||||||
<td>{% checkmark object.write_enabled %}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="row">{% trans "Created" %}</th>
|
|
||||||
<td>{{ object.created|isodatetime }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="row">{% trans "Expires" %}</th>
|
|
||||||
<td>{{ object.expires|isodatetime|placeholder }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="row">{% trans "Last used" %}</th>
|
|
||||||
<td>{{ object.last_used|isodatetime|placeholder }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="row">{% trans "Allowed IPs" %}</th>
|
|
||||||
<td>{{ object.allowed_ips|join:", "|placeholder }}</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
|
||||||
|
|||||||
@ -20,7 +20,14 @@
|
|||||||
{% if object.version == 1 %}
|
{% if object.version == 1 %}
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">{% trans "Token" %}</th>
|
<th scope="row">{% trans "Token" %}</th>
|
||||||
<td>{{ object.partial }}</td>
|
<td>
|
||||||
|
{% if settings.ALLOW_TOKEN_RETRIEVAL %}
|
||||||
|
<span id="secret" class="font-monospace" data-secret="{{ object.plaintext }}">{{ object.plaintext }}</span>
|
||||||
|
<button type="button" class="btn btn-primary toggle-secret float-end" data-bs-toggle="button">{% trans "Show Secret" %}</button>
|
||||||
|
{% else %}
|
||||||
|
{{ object.partial }}
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% else %}
|
{% else %}
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user