Skip to content

Commit b0b9bb4

Browse files
committed
Added code in the OpenID registration scope to look for registration matches also by email, to handle the case where somebody registered with a new email and only added it to the datatracker later. In this case, we would not have connected up the registration and the person record when first notified.
- Legacy-Id: 18008
1 parent 465d53e commit b0b9bb4

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

ietf/ietfauth/tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ def test_oidc_code_auth(self):
728728
RoleFactory(name_id='chair', person=person)
729729
meeting = MeetingFactory(type_id='ietf', date=datetime.date.today())
730730
MeetingRegistration.objects.create(
731-
meeting=meeting, person=person, first_name=person.first_name(), last_name=person.last_name(), email=person.email())
731+
meeting=meeting, person=None, first_name=person.first_name(), last_name=person.last_name(), email=person.email())
732732

733733
# Get access authorisation
734734
session = {}

ietf/ietfauth/utils.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
from ietf.group.models import Role, GroupFeatures
2626
from ietf.person.models import Person
27+
from ietf.utils.log import log
2728

2829
def user_is_person(user, person):
2930
"""Test whether user is associated with person."""
@@ -249,10 +250,19 @@ def scope_registration(self):
249250
meeting = get_current_ietf_meeting()
250251
person = self.user.person
251252
reg = MeetingRegistration.objects.filter(person=person, meeting=meeting).first()
252-
today = datetime.date.today()
253+
debug.show('reg')
254+
if not reg:
255+
# No person match; try to match by email address. They could
256+
# have registered with a new address and added it to the account
257+
# later.
258+
email_list = person.email_set.values_list('address')
259+
reg = MeetingRegistration.objects.filter(email__in=email_list, meeting=meeting).first()
260+
reg.person = person
261+
reg.save()
253262
info = {}
254263
if reg:
255264
# maybe register attendence if logged in to follow a meeting
265+
today = datetime.date.today()
256266
if meeting.date <= today <= meeting.end_date():
257267
client = ClientRecord.objects.get(client_id=self.client.client_id)
258268
if client.name == 'Meetecho' and not reg.attended:

0 commit comments

Comments
 (0)