-
-
Notifications
You must be signed in to change notification settings - Fork 545
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
Fix apple and saml backend filling user_details with None
values.
#490
base: master
Are you sure you want to change the base?
Fix apple and saml backend filling user_details with None
values.
#490
Conversation
It's a general convention that this project follows to use '' instead of `None`. Most of of the other backends use ''.
None
values.
It's a general convention that this project follows to use '' instead of `None`. Most of of the other backends use ''.
91c2fd9
to
1731bb0
Compare
@chdinesh1089 this breaks things in another way, that is if your project has those details this will override First and Last Names to empty strings on next login. This is why I changed it to However I think it is your project that should handle |
@maiiku Since most other backends in Also, it is mentioned in this project's code to avoid |
I think @maiiku is right here, looking at this code from
it seems that indeed the intent is that if the field (so first_name and last_name in our apple case) should be considered as "no value sent" and shouldn't overwrite the existing data on the user, then the value should be set to The question would be what should be the right behavior for SAML. |
@chdinesh1089 then as I said, if you wish to change this you should also propose a change to for name, value in details.items():
# Convert to existing user field if mapping exists
name = field_mapping.get(name, name)
if value is None or not hasattr(user, name) or name in protected:
continue
current_value = getattr(user, name, None)
if current_value == value:
continue
changed = True
setattr(user, name, value) as this actively overwrites in your database user details.
|
It seems to me that |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Proposed changes
Fixes apple and saml backends filling user_details with values containing
None
. This project generally uses''
instead ofNone
. Most other backends use''
.Types of changes
Please check the type of change your PR introduces:
Checklist
Put an
x
in the boxes that apply. You can also fill these out after creatingthe PR. If you're unsure about any of them, don't hesitate to ask. We're here to
help! This is simply a reminder of what we are going to look for before merging
your code.
Other information
Any other information that is important to this PR such as screenshots of how
the component looks before and after the change.