Ejemplo n.º 1
0
 def clean_username(self, username, request):
     """
     Allows the backend to clean the username, if the backend defines a
     clean_username method.
     """
     backend_str = request.session[auth.BACKEND_SESSION_KEY]
     backend = auth.load_backend(backend_str)
     try:
         username = backend.clean_username(username)
     except AttributeError:  # Backend has no clean_username method.
         pass
     return username
Ejemplo n.º 2
0
 def clean_username(self, username, request):
     """
     Allows the backend to clean the username, if the backend defines a
     clean_username method.
     """
     backend_str = request.session[auth.BACKEND_SESSION_KEY]
     backend = auth.load_backend(backend_str)
     try:
         username = backend.clean_username(username)
     except AttributeError: # Backend has no clean_username method.
         pass
     return username
Ejemplo n.º 3
0
 def _remove_invalid_user(self, request):
     """
     Removes the current authenticated user in the request which is invalid
     but only if the user is authenticated via the RemoteUserBackend.
     """
     try:
         stored_backend = load_backend(request.session.get(auth.BACKEND_SESSION_KEY, ''))
     except ImportError:
         # backend failed to load
         auth.logout(request)
     else:
         if isinstance(stored_backend, RemoteUserBackend):
             auth.logout(request)