Move api token info to security tab

This commit is contained in:
Paweł Jastrzębski 2022-01-04 08:52:39 +01:00
parent 80647d960a
commit 069b218828
4 changed files with 14 additions and 26 deletions

View File

@ -2,8 +2,8 @@
{% load i18n a17t_tags %} {% load i18n a17t_tags %}
{% block head_title %}{% trans "Change Password" %}{% endblock %} {% block head_title %}{% trans "Change authentication info" %}{% endblock %}
{% block page_title %}{% trans "Change Password" %}{% endblock %} {% block page_title %}{% trans "Change authentication info" %}{% endblock %}
{% block card %} {% block card %}
<form method="POST" action="{% url 'account_change_password' %}" class="password_change max-w-lg"> <form method="POST" action="{% url 'account_change_password' %}" class="password_change max-w-lg">
@ -11,4 +11,15 @@
{{ form|a17t }} {{ form|a17t }}
<button type="submit" name="action" class="button ~urge !high">{% trans "Change Password" %}</button> <button type="submit" name="action" class="button ~urge !high">{% trans "Change Password" %}</button>
</form> </form>
<hr class="sep">
<div>
<p class="label">Personal API token</p>
<div class="flex justify-between">
<span class='chip ~info !normal'>{{request.user.api_token}}</span>
<a class="href" href="{% url 'dashboard:api_token_refresh' %}">
<button type="submit" class="button ~warning !high">Refresh token</button>
</a>
</div>
</div>
</div>
{% endblock %} {% endblock %}

View File

@ -88,9 +88,6 @@
{% url 'account_set_password' as url %} {% url 'account_set_password' as url %}
{% include 'dashboard/includes/sidebar_portal.html' with label="Security" url=url %} {% include 'dashboard/includes/sidebar_portal.html' with label="Security" url=url %}
{% url 'dashboard:api_settings' as url %}
{% include 'dashboard/includes/sidebar_portal.html' with label="API" url=url %}
{% url 'account_logout' as url %} {% url 'account_logout' as url %}
{% include 'dashboard/includes/sidebar_portal.html' with label="Sign Out" url=url %} {% include 'dashboard/includes/sidebar_portal.html' with label="Sign Out" url=url %}

View File

@ -1,20 +0,0 @@
{% extends "base.html" %}
{% block content %}
<section class="max-w-xl content">
<h1>API</h1>
<div class="card ~neutral !low p-0" method="POST">
<div class="section ~neutral !normal p-4">
<div>
<p class="label">Token</p>
<div class="flex justify-between">
<span class='chip ~info !normal'>{{request.user.api_token}}</span>
<a class="href" href="{% url 'dashboard:api_token_refresh' %}">
<button type="submit" class="button ~warning !high">Refresh token</button>
</a>
</div>
</div>
</div>
</div>
</section>
{% endblock %}

View File

@ -165,4 +165,4 @@ class RefreshApiTokenView(LoginRequiredMixin, View):
def get(self, request): def get(self, request):
request.user.api_token = _default_api_token() request.user.api_token = _default_api_token()
request.user.save() request.user.save()
return redirect('dashboard:api_settings') return redirect('account_change_password')