diff --git a/netbox/netbox/configuration_example.py b/netbox/netbox/configuration_example.py index 76fdaaf02..b3b6fbb6c 100644 --- a/netbox/netbox/configuration_example.py +++ b/netbox/netbox/configuration_example.py @@ -72,6 +72,9 @@ ADMINS = [ # ('John Doe', 'jdoe@example.com'), ] +# Permit the retrieval of API tokens after their creation. +ALLOW_TOKEN_RETRIEVAL = False + # Enable any desired validators for local account passwords below. For a list of included validators, please see the # Django documentation at https://docs.djangoproject.com/en/stable/topics/auth/passwords/#password-validation. AUTH_PASSWORD_VALIDATORS = [ @@ -224,7 +227,3 @@ TIME_FORMAT = 'g:i a' SHORT_TIME_FORMAT = 'H:i:s' DATETIME_FORMAT = 'N j, Y g:i a' SHORT_DATETIME_FORMAT = 'Y-m-d H:i' - -# Allow API Tokens to be viewed after creation. Before NetBox 3.4 the default was to allow viewing of the tokens -# so this flag was created for backwards compatability. -ALLOW_TOKEN_RETRIEVAL = False diff --git a/netbox/templates/generic/object_edit.html b/netbox/templates/generic/object_edit.html index 47a7c24fb..c61fb723f 100644 --- a/netbox/templates/generic/object_edit.html +++ b/netbox/templates/generic/object_edit.html @@ -109,11 +109,9 @@ Context: - {% if not disable_addanother %} - {% endif %} {% endif %} Cancel {% endblock buttons %} diff --git a/netbox/templates/users/api_token.html b/netbox/templates/users/api_token.html index effbe6cf1..1a9296704 100644 --- a/netbox/templates/users/api_token.html +++ b/netbox/templates/users/api_token.html @@ -6,31 +6,55 @@ {% block content %}
The token has been created, you will need to copy the key as it will no longer be displayed for security purposes.
Key | -{{ object.key }} | +Key | +
+
+
+
+
+
+ {{ key }}
+ |
+
---|---|---|---|
Description | +{{ object.description|placeholder }} | +||
User | +{{ object.user }} | +||
Created | +{{ object.created|annotated_date }} | +||
Expires | ++ {% if object.expires %} + {{ object.expires|annotated_date }} + {% else %} + Never + {% endif %} + |