mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-15 17:17:02 +02:00
cleanup
This commit is contained in:
parent
7160efa515
commit
c0a967c4ea
1 changed files with 4 additions and 2 deletions
|
@ -79,12 +79,14 @@ class OpenIdConnectBackend(ModelBackend):
|
||||||
- 'first_name', 'last_name' or 'phone' will be updated if the provided value is not empty.
|
- 'first_name', 'last_name' or 'phone' will be updated if the provided value is not empty.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
fields_to_check = ["first_name", "last_name", "phone"]
|
||||||
|
|
||||||
# Iterate over fields to update
|
# Iterate over fields to update
|
||||||
for key, value in kwargs.items():
|
for key, value in kwargs.items():
|
||||||
# Check if the field is not 'first_name', 'last_name', or 'phone',
|
# Check if the field is not 'first_name', 'last_name', or 'phone',
|
||||||
# or if it's 'first_name' or 'last_name' or 'phone' and the provided value is not empty
|
# or if it's 'first_name' or 'last_name' or 'phone' and the provided value is not empty
|
||||||
if key not in ["first_name", "last_name", "phone"] or (
|
if key not in fields_to_check or (
|
||||||
key in ["first_name", "last_name", "phone"] and value
|
key in fields_to_check and value
|
||||||
):
|
):
|
||||||
# Update the corresponding attribute of the user object
|
# Update the corresponding attribute of the user object
|
||||||
setattr(user, key, value)
|
setattr(user, key, value)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue