From 64f112d54562388c200ce386a21c2486e557af28 Mon Sep 17 00:00:00 2001 From: Michiel Uitdehaag Date: Wed, 29 Aug 2018 12:55:09 +0200 Subject: [PATCH] Simple fix to allow a user to verify his/her email address --- app/Controller/CoInvitesController.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/app/Controller/CoInvitesController.php b/app/Controller/CoInvitesController.php index 14d41d0e4..69484f23c 100644 --- a/app/Controller/CoInvitesController.php +++ b/app/Controller/CoInvitesController.php @@ -140,7 +140,22 @@ protected function calculateImpliedCoId($data = null) { filter_var($this->request->params['pass'][0],FILTER_SANITIZE_SPECIAL_CHARS)))); } } - + else if($this->action == "verifyEmailAddress") { + // verifyEmailAddress has an email address id as parameter. Use that to determine the CO + + if(!empty($this->request->params['named']['email_address_id'])) { + $args = array(); + $args['conditions']['EmailAddress.id'] = $this->request->params['named']['email_address_id']; + $args['contain'] = array('CoPerson'); + + $ea = $this->CoInvite->CoPerson->EmailAddress->find('first', $args); + + if(!empty($ea) && !empty($ea['CoPerson'])) { + return $ea['CoPerson']['co_id']; + } + } + } + if($this->action == "send" && !empty($this->request->params['named']['copersonid'])) { $coId = $this->CoInvite->CoPerson->field('co_id', array('id' => $this->request->params['named']['copersonid']));