Use POST to api token refresh
This commit is contained in:
parent
b286c80754
commit
5e48e2dcf5
@ -16,9 +16,10 @@
|
|||||||
<p class="label mb-1">Personal API token</p>
|
<p class="label mb-1">Personal API token</p>
|
||||||
<div class="flex justify-between">
|
<div class="flex justify-between">
|
||||||
<span class='chip ~info !normal'>{{request.user.api_token}}</span>
|
<span class='chip ~info !normal'>{{request.user.api_token}}</span>
|
||||||
<a class="href" href="{% url 'dashboard:api_token_refresh' %}">
|
<form method="POST" action="{% url 'dashboard:api_token_refresh' %}">
|
||||||
<button type="submit" class="button ~neutral @high">Refresh token</button>
|
{% csrf_token %}
|
||||||
</a>
|
<button type="submit" name="action" class="button ~neutral @high">{% trans "Refresh token" %}</button>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<p class="support mt-1">To learn more about the API, see our <a href="https://github.com/milesmcc/shynet/blob/master/GUIDE.md#api">API guide</a>.</p>
|
<p class="support mt-1">To learn more about the API, see our <a href="https://github.com/milesmcc/shynet/blob/master/GUIDE.md#api">API guide</a>.</p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -158,7 +158,7 @@ class ServiceSessionView(LoginRequiredMixin, PermissionRequiredMixin, DetailView
|
|||||||
|
|
||||||
|
|
||||||
class RefreshApiTokenView(LoginRequiredMixin, View):
|
class RefreshApiTokenView(LoginRequiredMixin, View):
|
||||||
def get(self, request):
|
def post(self, request):
|
||||||
request.user.api_token = _default_api_token()
|
request.user.api_token = _default_api_token()
|
||||||
request.user.save()
|
request.user.save()
|
||||||
return redirect('account_change_password')
|
return redirect('account_change_password')
|
||||||
|
Loading…
Reference in New Issue
Block a user