X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/f54d6aa545240a08a010277671e676fad038b8dd..18948ce1d84878c6307f2d0b732a9dbd03778cfb:/src/apiclient/views.py?ds=sidebyside 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'))