plateforme-corres2math/apps/registration/auth.py

18 lines
519 B
Python
Raw Normal View History

2020-12-26 20:26:26 +00:00
# Copyright (C) 2020 by Animath
# SPDX-License-Identifier: GPL-3.0-or-later
from cas_server.auth import DjangoAuthUser # pragma: no cover
2020-10-28 16:19:25 +00:00
class CustomAuthUser(DjangoAuthUser): # pragma: no cover
2020-10-28 16:19:25 +00:00
"""
Override Django Auth User model to define a custom Matrix username.
"""
def attributs(self):
d = super().attributs()
if self.user:
d["matrix_username"] = self.user.registration.matrix_username
d["display_name"] = str(self.user.registration)
2020-10-28 16:19:25 +00:00
return d