diff --git a/api/v1/invitations/InvitationController.php b/api/v1/invitations/InvitationController.php index a6d1c9811e2..b5273908f6e 100644 --- a/api/v1/invitations/InvitationController.php +++ b/api/v1/invitations/InvitationController.php @@ -34,7 +34,6 @@ use PKP\invitation\models\InvitationModel; use PKP\security\Role; use PKP\validation\ValidatorFactory; -use Validator; class InvitationController extends PKPBaseController { diff --git a/classes/invitation/invitations/userRoleAssignment/handlers/UserRoleAssignmentInviteRedirectController.php b/classes/invitation/invitations/userRoleAssignment/handlers/UserRoleAssignmentInviteRedirectController.php index 319d9486bdd..513087c441b 100644 --- a/classes/invitation/invitations/userRoleAssignment/handlers/UserRoleAssignmentInviteRedirectController.php +++ b/classes/invitation/invitations/userRoleAssignment/handlers/UserRoleAssignmentInviteRedirectController.php @@ -39,13 +39,16 @@ public function getInvitation(): UserRoleAssignmentInvite public function acceptHandle(Request $request): void { $templateMgr = TemplateManager::getManager($request); - $templateMgr->assign('invitation', $this->invitation); + + $this->getInvitation()->changeInvitationUserIdUsingUserEmail(); + + $templateMgr->assign('invitation', $this->getInvitation()); $context = $request->getContext(); $steps = new AcceptInvitationStep(); - $invitationModel = $this->invitation->invitationModel->toArray(); + $invitationModel = $this->getInvitation()->invitationModel->toArray(); $user = $invitationModel['userId'] ?Repo::user()->get($invitationModel['userId']) : null; $templateMgr->setState([ - 'steps' => $steps->getSteps($this->invitation,$context,$user), + 'steps' => $steps->getSteps($this->getInvitation(),$context,$user), 'primaryLocale' => $context->getData('primaryLocale'), 'pageTitle' => __('invitation.wizard.pageTitle'), 'invitationId' => (int)$request->getUserVar('id') ?: null, diff --git a/classes/invitation/invitations/userRoleAssignment/handlers/api/UserRoleAssignmentCreateController.php b/classes/invitation/invitations/userRoleAssignment/handlers/api/UserRoleAssignmentCreateController.php index 833c65f9e6c..cf19d9b9cc5 100644 --- a/classes/invitation/invitations/userRoleAssignment/handlers/api/UserRoleAssignmentCreateController.php +++ b/classes/invitation/invitations/userRoleAssignment/handlers/api/UserRoleAssignmentCreateController.php @@ -114,7 +114,7 @@ public function invite(Request $illuminateRequest): JsonResponse $this->invitation->getPayload()->sendEmailAddress = $existingUser->getEmail(); } - $this->invitation->getPayload()->inviteStagePayload = $this->invitation->getPayload(); + $this->invitation->getPayload()->inviteStagePayload = $this->invitation->getPayload()->toArray(); $this->invitation->updatePayload(); diff --git a/classes/invitation/invitations/userRoleAssignment/payload/UserRoleAssignmentInvitePayload.php b/classes/invitation/invitations/userRoleAssignment/payload/UserRoleAssignmentInvitePayload.php index 81c8e2d2cc0..742d80147b4 100644 --- a/classes/invitation/invitations/userRoleAssignment/payload/UserRoleAssignmentInvitePayload.php +++ b/classes/invitation/invitations/userRoleAssignment/payload/UserRoleAssignmentInvitePayload.php @@ -163,7 +163,7 @@ public function getValidationRules(UserRoleAssignmentInvite $invitation, Validat 'orcid' ], 'shouldUseInviteData' => [ - 'prohibited', + new ProhibitedIncludingNull($validationContext === ValidationContext::VALIDATION_CONTEXT_REFINE||$validationContext === ValidationContext::VALIDATION_CONTEXT_POPULATE), ], ];