Custom redirect to cancel social login django-allauth
I am using django-allauth for social login in my django app. When a user is prompted with a social connection dialog, such as a Facebook login window, for example, they can refuse the permission request.
In this case, the user is currently being redirected to / accounts / social / login / cancel /. Is there a way that I can redirect it to its own url?
+3
source to share
1 answer
I figured out that I can override the allauth social login cancellation view with my custom view. I followed the instructions in this blog post - How to Override a View from an External Django Application .
All I had to do was define a view with my custom logic and place the url definition for that view above the allauth urls definition in urls.py
views.py:
def login_cancelled(request):
...
custom_logic
...
urls.py
from myapp.views import login_cancelled
urlpattenrs = patterns(
...
url(r'^accounts/social/login/cancelled/$', login_cancelled),
url(r'^accounts/', include('allauth.urls')),
...
)
+6
source to share