X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/f54d6aa545240a08a010277671e676fad038b8dd..4a8b54a88de9d528031701ec97224752f2e2b25b:/src/apiclient/views.py?ds=inline diff --git a/src/apiclient/views.py b/src/apiclient/views.py index 666ef481..e43ae0ca 100644 --- a/src/apiclient/views.py +++ b/src/apiclient/views.py @@ -6,6 +6,7 @@ from urllib.parse import parse_qsl from django.contrib.auth.decorators import login_required from django.urls import reverse from django.http import HttpResponseRedirect, HttpResponse +from django.views.decorators.http import require_POST import oauth2 from apiclient.models import OAuthConnection @@ -60,4 +61,11 @@ def oauth_callback(request, beta=False): conn.token_secret = access_token['oauth_token_secret'] conn.save() - return HttpResponseRedirect('/') + return HttpResponseRedirect(reverse('documents_user')) + + +@login_required +@require_POST +def disconnect(request): + request.user.oauthconnection_set.filter(beta=False).delete() + return HttpResponseRedirect(reverse('documents_user'))