fnp
/
redakcja.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Woblink
[redakcja.git]
/
src
/
apiclient
/
views.py
diff --git
a/src/apiclient/views.py
b/src/apiclient/views.py
index
666ef48
..
e43ae0c
100644
(file)
--- 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.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
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()
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'))