I am using django-allauth for social login in my django application. When a user is prompted with a social-login dialog, Facebook login window for ex., he can choose to decline the request for permissions.
In this case, the user is currently getting redirected to /accounts/social/login/cancelled/. Is there some way by which I can redirect him to a custom url?
I figured out that I can override allauth's social login cancel view with my custom view. I followed the instructions described in this blog post - How to override a view from an external Django app.
All I needed to do was define a view with my custom logic and place a url definition for this 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')),
...
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With