Clean a CAS-returned username
cas.eleves.ens.fr allows users such as ' FooBAr ' or 'foobar' in indifferently
This commit is contained in:
parent
17e71451fe
commit
b1727f7e07
2 changed files with 8 additions and 1 deletions
|
@ -87,7 +87,7 @@ AUTH_PASSWORD_VALIDATORS = [
|
||||||
|
|
||||||
AUTHENTICATION_BACKENDS = [
|
AUTHENTICATION_BACKENDS = [
|
||||||
'django.contrib.auth.backends.ModelBackend',
|
'django.contrib.auth.backends.ModelBackend',
|
||||||
'django_cas_ng.backends.CASBackend',
|
'mainsite.cas_backend.BOcalCASBackend',
|
||||||
]
|
]
|
||||||
|
|
||||||
CAS_ADMIN_PREFIX = '/yaes5eiS' # we don't want CAS to take over /admin auth
|
CAS_ADMIN_PREFIX = '/yaes5eiS' # we don't want CAS to take over /admin auth
|
||||||
|
|
7
mainsite/cas_backend.py
Normal file
7
mainsite/cas_backend.py
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
from django_cas_ng.backends import CASBackend
|
||||||
|
|
||||||
|
|
||||||
|
class BOcalCASBackend(CASBackend):
|
||||||
|
# Partly from Robin Champenois's "ExperiENS". Thanks!
|
||||||
|
def clean_username(self, username):
|
||||||
|
return username.lower().strip()
|
Loading…
Reference in a new issue