handle sites without a national registration number field

This commit is contained in:
Frédéric Péters 2017-04-05 09:35:11 +02:00
parent 4e5b335cb8
commit f4240b41b0
1 changed files with 3 additions and 2 deletions

View File

@ -24,13 +24,14 @@ def on_user_logged_in(sender, request, user, **kwargs):
return
if user.backend == 'authentic2_auth_fedict.backends.FedictBackend':
return
attribute = None
for attr_name in ('niss', 'nrn'):
try:
attribute = Attribute.objects.get(name=attr_name)
break
except Attribute.DoesNotExist:
pass
break
else:
if not attribute:
return
try:
av = AttributeValue.objects.with_owner(user).filter(attribute=attribute, verified=True)[0]