Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from django.shortcuts import redirect
- from django.urls import reverse_lazy
- from social_django.middleware import SocialAuthExceptionMiddleware
- from social_core.exceptions import SocialAuthBaseException
- class CustomSocialAuthExceptionMiddleware(SocialAuthExceptionMiddleware):
- def process_exception(self, request, exception):
- if issubclass(exception.__class__, SocialAuthBaseException):
- return redirect(reverse_lazy('staff:auth:login'))
- else:
- raise exception
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement