django-mama-cas
django-mama-cas copied to clipboard
#79 - Custom Username CAS
@jbittel
(recreate branch and pull request)
Allow using another field as the username, e.g: email or TAX ID (CPF in Brazil).
def user_name_attributes(user, service): isn't working.
issue #79
@robertomorati looking at this now, while it looks good to me, I'd say we need a test to cover the change. Could you please add it to the PR?
@robertomorati looking at this now, while it looks good to me, I'd say we need a test to cover the change. Could you please add it to the PR?
Hi @manelclos I'll take a time to do that, may be this weekend. I tested in production without problems in 2019.
@robertomorati can you please describe how to reproduce this problem? I'm looking at the code and this is covered by tests, so I'm interested in understanding why user_name_attributes
is failing.
Is your configuration similar to this? https://github.com/jbittel/django-mama-cas/blob/master/mama_cas/tests/settings.py#L61
Hi @manelclos
I'm really sorry for the delay in answering you. I'll try to find the code of the respective project to see the settings file.
Thank you for your attention.
Hello @manelclos,
On the project settings.py
, we did the specified configurations and:
def user_name_attributes(user, service):
attributes = {}
attributes['username'] = user.get_username()
try:
if user.healthprofessional:
attributes['username'] = user.healthprofessional.cpf
except Exception:
pass
attributes['full_name'] = user.get_full_name()
attributes['short_name'] = user.get_short_name()
return attributes
However, since no one else has had this problem, I think we can close the issue.