Verified Commit acae748b authored by Côme Chilliet's avatar Côme Chilliet
Browse files

🚑 fix(invitations) Add more precise error message when invitation has been deleted

The field fdRegistrationInvitationDN may get emptied by a foreignKey so
 we need to handle this case without PHP error

issue #5850
parent dc4a2453
......@@ -67,6 +67,9 @@ class invitationPage extends standAlonePage
throw new FusionDirectoryException(sprintf(_('Found several invitations matching token "%s"'), $token));
}
$registration = reset($registrations);
if (empty($registration['fdRegistrationInvitationDN'])) {
throw new FusionDirectoryException(sprintf(_('The invitation matching token "%s" does not exist anymore'), $_GET['token']));
}
}
if ($registration['fdRegistrationState'] != 'sent') {
switch ($registration['fdRegistrationState']) {
......
......@@ -88,6 +88,9 @@ class publicFormPage extends standAlonePage
throw new FusionDirectoryException(sprintf(_('Found several invitations matching token "%s"'), $_GET['token']));
}
$this->registration = reset($registrations);
if (empty($this->registration['fdRegistrationInvitationDN'])) {
throw new FusionDirectoryException(sprintf(_('The invitation matching token "%s" does not exist anymore'), $_GET['token']));
}
$invitations = objects::ls(
'invitation',
array(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment