Example #1
0
 /**
  * Sets up ORCID params and redirects to ORCID authorize URL
  *
  * @param   object  $view  view object
  * @param   object  $tpl   template object
  * @return  void
  */
 public function display($view, $tpl)
 {
     // Set up the config for the ORCID api instance
     $oauth = new Oauth();
     $oauth->setClientId($this->params->get('client_id'))->setScope('/authenticate')->setState($view->return)->showLogin()->setRedirectUri(self::getRedirectUri('orcid'));
     // If we're linking an account, set any info that we might already know
     if (!User::isGuest()) {
         $oauth->setEmail(User::get('email'));
         $oauth->setFamilyNames(User::get('surname'));
         $oauth->setGivenNames(User::get('givenName'));
     }
     // Create and follow the authorization URL
     App::redirect($oauth->getAuthorizationUrl());
 }