Skip to content
Snippets Groups Projects
middleware.py 511 B
Newer Older
  • Learn to ignore specific revisions
  • from social_core.exceptions import AuthForbidden
    from social_django.middleware import SocialAuthExceptionMiddleware as _SocialAuthExceptionMiddleware
    
    
    Dan Braghis's avatar
    Dan Braghis committed
    
    
    class SocialAuthExceptionMiddleware(_SocialAuthExceptionMiddleware):
        """
        Wrapper around SocialAuthExceptionMiddleware to customise messages
        """
        def get_message(self, request, exception):
            if isinstance(exception, AuthForbidden):
    
                return 'Your credentials are not recognised.'
    
    Dan Braghis's avatar
    Dan Braghis committed
            super().get_message(request, exception)