Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#79 - Custom Username CAS #81

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

robertomorati
Copy link

@robertomorati robertomorati commented May 27, 2019

@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

@manelclos
Copy link
Collaborator

@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
Copy link
Author

@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.

@manelclos
Copy link
Collaborator

@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

@robertomorati
Copy link
Author

robertomorati commented Apr 8, 2021

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.

@robertomorati
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants