Skip to content

Commit 5f7fb2e

Browse files
committed
Added a guard against trying to access attributes of a None object.
- Legacy-Id: 15236
1 parent 4c9903c commit 5f7fb2e

1 file changed

Lines changed: 14 additions & 13 deletions

File tree

ietf/ietfauth/views.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -586,20 +586,21 @@ def login(request, extra_context=None):
586586
user = User.objects.filter(username=username).first()
587587
#
588588
require_consent = []
589-
if user.person and not user.person.consent:
590-
person = user.person
591-
if person.name != person.name_from_draft:
592-
require_consent.append("full name")
593-
if person.ascii != person.name_from_draft:
594-
require_consent.append("ascii name")
595-
if person.biography:
596-
require_consent.append("biography")
597-
if user.communitylist_set.exists():
598-
require_consent.append("draft notification subscription(s)")
599-
for email in person.email_set.all():
600-
if not email.origin.split(':')[0] in ['author', 'role', 'reviewer', 'liaison', 'shepherd', ]:
601-
require_consent.append("email address(es)")
602589
if user:
590+
if user.person and not user.person.consent:
591+
person = user.person
592+
if person.name != person.name_from_draft:
593+
require_consent.append("full name")
594+
if person.ascii != person.name_from_draft:
595+
require_consent.append("ascii name")
596+
if person.biography:
597+
require_consent.append("biography")
598+
if user.communitylist_set.exists():
599+
require_consent.append("draft notification subscription(s)")
600+
for email in person.email_set.all():
601+
if not email.origin.split(':')[0] in ['author', 'role', 'reviewer', 'liaison', 'shepherd', ]:
602+
require_consent.append("email address(es)")
603+
603604
try:
604605
identify_hasher(user.password)
605606
except ValueError:

0 commit comments

Comments
 (0)