utils: apply mapping to custom attributes before static ones (#27044)

It's impossible to set a verified first_name or last_name without it.
This commit is contained in:
Benjamin Dauvergne 2018-10-05 16:47:26 +02:00
parent fa9c460eed
commit dd43c144c5
1 changed files with 5 additions and 5 deletions

View File

@ -151,11 +151,6 @@ def apply_user_info_mappings(user, user_info):
continue
save_user = True
user.set_password(value)
elif hasattr(user, attribute):
save_user = True
if mapping.get('if-empty') and getattr(user, attribute):
continue
setattr(user, attribute, value)
elif hasattr(user.attributes, attribute):
if mapping.get('if-empty') and getattr(user.attributes, attribute):
continue
@ -163,6 +158,11 @@ def apply_user_info_mappings(user, user_info):
setattr(user.verified_attributes, attribute, value)
else:
setattr(user.attributes, attribute, value)
elif hasattr(user, attribute):
save_user = True
if mapping.get('if-empty') and getattr(user, attribute):
continue
setattr(user, attribute, value)
else:
logger.warning(u'auth_fc: unknown attribute in user_info mapping: %s', attribute)
continue