From 9067a2da7c0d0aab33d578c442ceeec1187f2861 Mon Sep 17 00:00:00 2001 From: Henrik Levkowetz Date: Thu, 20 Sep 2018 18:04:23 +0000 Subject: [PATCH] Fixed an issue where a user record without matching person record will cause an exception. - Legacy-Id: 15478 --- ietf/ietfauth/views.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ietf/ietfauth/views.py b/ietf/ietfauth/views.py index 4d44f8d64..687d0bdd9 100644 --- a/ietf/ietfauth/views.py +++ b/ietf/ietfauth/views.py @@ -48,6 +48,7 @@ from django.contrib.auth.hashers import identify_hasher from django.contrib.auth.models import User from django.contrib.auth.views import LoginView from django.contrib.sites.models import Site +from django.core.exceptions import ObjectDoesNotExist from django.core.validators import ValidationError from django.urls import reverse as urlreverse from django.utils.safestring import mark_safe @@ -587,8 +588,11 @@ def login(request, extra_context=None): user = User.objects.filter(username=username).first() # if user: - if user.person and not user.person.consent: - require_consent = user.person.needs_consent() + try: + if user.person and not user.person.consent: + require_consent = user.person.needs_consent() + except ObjectDoesNotExist: + pass try: identify_hasher(user.password) except ValueError: