public function sendconfirmationcodeAction() { $this->_helper->layout->disableLayout(); if ($this->session->isNewUser !== true && $this->session->userid !== -1) { $this->_helper->viewRenderer->setNoRender(); header("Location: " . "https://" . $_SERVER['HTTP_HOST']); return; } $error = null; $profilename = null; $id = isset($_POST["id"]) && is_numeric($_POST["id"]) ? intval($_POST["id"]) : null; $accounttype = str_replace("-sp", "", trim($this->session->authSource)); $accounttype = $accounttype === "" ? null : $accounttype; $accountname = trim($this->session->authUid); $accountname = $accountname === "" ? null : $accountname; $this->view->session = $this->session; $this->view->id = trim($id); $this->view->accounttype = trim($accounttype); $this->view->accountname = trim($accountname); $this->view->profilename = trim($profilename); $this->view->implicitconnect = false; $this->view->implicitpending = false; //Check for invalid data if ($id === null) { $this->view->error = "No profile information given"; return; } if ($accounttype === null) { $this->view->error = "No account type is given"; return; } if ($accountname === null) { $this->view->error = "No account information given"; return; } //Check if account is already pending for connection to a profile implicitly or through a different session //In this case the view should inform the user and autorefresh to display the confirmation form. if (AccountConnect::isPending($this->session) === true) { $this->view->error = "Your account seems to be waiting for connection approval for another profile"; $this->view->implicitpending = false; //Update session so user will be redirected to the appropriate form SamlAuth::setupSamlAuth($this->session); return; } //Check if current account is already connected to a profile implicitly or through a different session //In this case the view should inform the user and autorefresh to the portal if (AccountConnect::isConnected($this->session) !== false) { $this->view->error = "Your account is already connected"; $this->view->implicitconnect = true; //Update session so user will auto login on page refresh SamlAuth::setupSamlAuth($this->session); return; } //Find profile for connection $profile = null; $ppl = new Default_Model_Researchers(); $ppl->filter->id->equals($id); if (count($ppl->items) > 0) { //Profile found $profile = $ppl->items[0]; $this->view->profilename = $profile->firstName . " " . $profile->lastName; } else { //profile not found $this->view->error = "Requested profile not found"; return; } //Procceed with sending the request AccountConnect::requestAccountConnection($this->session, $profile); $this->view->session = $this->session; $this->view->error = null; return; }