apps: add *_verified attributes in user_info for validated accounts (fixes #24193)

This commit is contained in:
Benjamin Dauvergne 2018-07-11 14:35:20 +02:00
parent 019dfbd590
commit 6bfbf66fcd
1 changed files with 11 additions and 2 deletions

View File

@ -429,8 +429,17 @@ class AppConfig(django.apps.AppConfig):
user.attributes.validation_date.isoformat())
user_info['validation_context'] = user.attributes.validation_context
# pass user.ou.slug for agent's users
if user.ou and user.ou.slug != 'usagers':
user_info['ou'] = user.ou.slug
if user.ou:
if user.ou.slug != 'usagers':
user_info['ou'] = user.ou.slug
else:
if user.attributes.validated:
for name in ['first_name', 'last_name',
'given_name', 'family_name', 'title',
'gender', 'birthdate',
'birthplace_insee', 'birthplace',
'birthcountry_insee', 'birthcountry']:
user_info['%s_verified' % name] = True
if 'crown' in scope_set:
user_info['preferred_username'] = user.attributes.preferred_username
user_info['preferred_givenname'] = user.attributes.preferred_givenname