MCPcopy
hub / github.com/django/django / clean_username

Method clean_username

django/contrib/auth/middleware.py:217–228  ·  view source on GitHub ↗

Allow the backend to clean the username, if the backend defines a clean_username method.

(self, username, request)

Source from the content-addressed store, hash-verified

215 await auth.alogin(request, user)
216
217 def clean_username(self, username, request):
218 """
219 Allow the backend to clean the username, if the backend defines a
220 clean_username method.
221 """
222 backend_str = request.session[auth.BACKEND_SESSION_KEY]
223 backend = auth.load_backend(backend_str)
224 try:
225 username = backend.clean_username(username)
226 except AttributeError: # Backend has no clean_username method.
227 pass
228 return username
229
230 async def aclean_username(self, username, request):
231 """See clean_username."""

Callers 2

process_requestMethod · 0.95
aclean_usernameMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected