Skip to content
Snippets Groups Projects
Verified Commit 44eb330d authored by Andreas Ellewsen's avatar Andreas Ellewsen
Browse files

Log when wrong person uses invitation

parent 3c51ae60
No related branches found
No related tags found
1 merge request!282Handle wrong person following invitation link
Pipeline #117173 passed
...@@ -622,6 +622,13 @@ class GregOIDCBackend(ValidatingOIDCBackend): ...@@ -622,6 +622,13 @@ class GregOIDCBackend(ValidatingOIDCBackend):
not inv_person.registration_completed_date not inv_person.registration_completed_date
and not name_diff_too_large(old_name, inv_name, 4) and not name_diff_too_large(old_name, inv_name, 4)
): ):
logger.info(
"Invitation (%s) opened by existing person (%s)."
" Giving role to them and deleting invited person (%s)",
invitation_link.invitation.id,
old_person.id,
inv_person.id,
)
# The name is close and the invited person has not completed # The name is close and the invited person has not completed
# registration. Give the role to the existing person, and # registration. Give the role to the existing person, and
# delete the invited one. # delete the invited one.
...@@ -632,6 +639,15 @@ class GregOIDCBackend(ValidatingOIDCBackend): ...@@ -632,6 +639,15 @@ class GregOIDCBackend(ValidatingOIDCBackend):
else: else:
# The logged in user has gotten someone else's invitation, and # The logged in user has gotten someone else's invitation, and
# the invitation should be disabled. # the invitation should be disabled.
logger.warning(
"Illegal person accessed invitation (%s). Invitation belongs to"
" person id %s, but was access by person id %s. Expiring"
" InvitationLink %s.",
invitation_link.invitation.id,
inv_person.id,
old_person.id,
invitation_link.id,
)
invitation_link.expire = timezone.now() invitation_link.expire = timezone.now()
invitation_link.save() invitation_link.save()
else: else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment