#31 API Frontend token generating

* adds frontend settings for users to create API tokens on their user settings
This commit is contained in:
2022-01-27 11:37:38 +01:00
parent fc0cd2f086
commit c9bccec1a5
16 changed files with 255 additions and 29 deletions

View File

@@ -1,9 +1,9 @@
{% load i18n fontawesome_5 %}
<div class="input-group w-100" title="{{ widget.value|stringformat:'s' }}">
<input id="gen-id-input" aria-describedby="gen-id-btn" type="{{ widget.type }}" name="{{ widget.name }}"{% if widget.value != None %} value="{{ widget.value|stringformat:'s' }}"{% endif %}{% include "django/forms/widgets/attrs.html" %}>
<input id="gen-data-input" aria-describedby="gen-data-btn" type="{{ widget.type }}" name="{{ widget.name }}"{% if widget.value != None %} value="{{ widget.value|stringformat:'s' }}"{% endif %}{% include "django/forms/widgets/attrs.html" %}>
<div class="input-group-append" onclick="fetchNewIdentifier()">
<span id="gen-id-btn" class="btn btn-default" value="{% trans 'Generate new' %}" title="{% trans 'Generate new' %}">{% fa5_icon 'dice' %}</span>
<span id="gen-data-btn" class="btn btn-default" value="{% trans 'Generate new' %}" title="{% trans 'Generate new' %}">{% fa5_icon 'dice' %}</span>
</div>
</div>
<script>
@@ -13,7 +13,7 @@
return response.json();
})
.then(function(data){
document.getElementById("gen-id-input").value = data["identifier"];
document.getElementById("gen-data-input").value = data["gen_data"];
})
.catch(function(error){
console.log(error);