Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
""" This middleware performs different actions.
- It checks that the HTTP request method is authorized on the plateform.
- It requires a user to be authenticated to view any page other than LOGIN_URL. Exemptions to this requirement can optionally be specified in settings via a list of regular expressions in LOGIN_EXEMPT_URLS (which you can copy from your urls.py).
Requires authentication middleware and template context processors to be loaded. You'll get an error if they aren't. """
# Check that the request.method is authorized on the site
request, "user" ), "The RexDriRequestMiddleware\ requires authentication middleware to be installed. Edit your\ MIDDLEWARE_CLASSES setting to insert\ 'django.contrib.auth.middlware.AuthenticationMiddleware'. If that doesn't\ work, ensure your TEMPLATE_CONTEXT_PROCESSORS setting includes\ 'django.core.context_processors.auth'."
# If the user is not authenticated redirect him/her to the login page return HttpResponseRedirect(settings.LOGIN_URL + "?next=/" + path)
else: # User is authenticated # We check if he / she has validated the CGU and the full RGPD # Handling of banned users return HttpResponseRedirect("/banned_note/") |