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')),
...
)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.