plateforme-corres2math/apps/registration/auth.py

15 lines
378 B
Python
Raw Normal View History

2020-10-28 16:19:25 +00:00
from cas_server.auth import DjangoAuthUser
from django.utils.text import slugify
class CustomAuthUser(DjangoAuthUser):
"""
Override Django Auth User model to define a custom Matrix username.
"""
def attributs(self):
d = super().attributs()
if self.user:
d["matrix_username"] = slugify(str(self.user.registration))
return d