From c0a967c4ea4a72f42746c2f8bb4a4aeabb0660e4 Mon Sep 17 00:00:00 2001 From: Rachid Mrad Date: Wed, 1 May 2024 14:30:08 -0400 Subject: [PATCH] cleanup --- src/djangooidc/backends.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/djangooidc/backends.py b/src/djangooidc/backends.py index 81e782c7b..df086059e 100644 --- a/src/djangooidc/backends.py +++ b/src/djangooidc/backends.py @@ -79,12 +79,14 @@ class OpenIdConnectBackend(ModelBackend): - '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 for key, value in kwargs.items(): # 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 - if key not in ["first_name", "last_name", "phone"] or ( - key in ["first_name", "last_name", "phone"] and value + if key not in fields_to_check or ( + key in fields_to_check and value ): # Update the corresponding attribute of the user object setattr(user, key, value)