lock first name and last name (fixes #27044)

This commit is contained in:
Benjamin Dauvergne 2018-10-05 19:03:41 +02:00
parent dd43c144c5
commit 806b4cdbab
2 changed files with 17 additions and 2 deletions

View File

@ -67,8 +67,14 @@ class AppSettings(object):
@property
def user_info_mappings(self):
return self._setting('USER_INFO_MAPPINGS', {
'last_name': 'family_name',
'first_name': 'given_name',
'last_name': {
'ref': 'family_name',
'verified': True,
},
'first_name': {
'ref': 'given_name',
'verified': True,
},
'email': 'email',
})

View File

@ -122,6 +122,9 @@ def test_login_simple(app, fc_settings, caplog, hooks, exp):
else:
assert User.objects.count() == 1
if User.objects.count():
user = User.objects.get()
assert user.verified_attributes.first_name == u'Ÿuñe'
assert user.verified_attributes.last_name == u'Frédérique'
assert path(response['Location']) == '/idp/'
assert hooks.event[1]['kwargs']['name'] == 'login'
assert hooks.event[1]['kwargs']['service'] == 'portail'
@ -352,6 +355,9 @@ def test_registration1(app, fc_settings, caplog, hooks):
with httmock.HTTMock(access_token_response, user_info_response):
response = app.get(callback + '&code=zzz&state=%s' % state, status=302)
assert models.FcAccount.objects.count() == 1
user = User.objects.get()
assert user.verified_attributes.first_name == u'Ÿuñe'
assert user.verified_attributes.last_name == u'Frédérique'
response = app.get('/accounts/')
response = response.click('Delete link')
response.form.set('new_password1', 'ikKL1234')
@ -435,6 +441,9 @@ def test_registration2(app, fc_settings, caplog, hooks):
with httmock.HTTMock(access_token_response, user_info_response):
response = app.get(callback + '&code=zzz&state=%s' % state, status=302)
assert models.FcAccount.objects.count() == 1
user = User.objects.get()
assert user.verified_attributes.first_name == u'Ÿuñe'
assert user.verified_attributes.last_name == u'Frédérique'
response = app.get('/accounts/')
response = response.click('Delete link')
response.form.set('new_password1', 'ikKL1234')