function run() { $openid = getOpenIDURL(); $consumer = getConsumer(); // Begin the OpenID authentication process. $auth_request = $consumer->begin($openid); // No auth request means we can't begin OpenID. if (!$auth_request) { // check for new install, if no, go to index, else goto new-install page require_once 'CRM/Core/BAO/UFMatch.php'; $contactIds = CRM_Core_BAO_UFMatch::getContactIDs(); if (count($contactIds) > 0) { displayError("Authentication error; not a valid OpenID."); } else { $session =& CRM_Core_Session::singleton(); $session->set('new_install', true); include 'new_install.html'; exit(1); } } $sreg_request = Auth_OpenID_SRegRequest::build(array('nickname'), array('fullname', 'email')); if ($sreg_request) { $auth_request->addExtension($sreg_request); } $policy_uris = null; if (isset($_REQUEST['policies'])) { $policy_uris = $_REQUEST['policies']; } $pape_request = new Auth_OpenID_PAPE_Request($policy_uris); if ($pape_request) { $auth_request->addExtension($pape_request); } $redirect_url = $auth_request->redirectURL(getTrustRoot(), getReturnTo()); // If the redirect URL can't be built, display an error // message. if (Auth_OpenID::isFailure($redirect_url)) { displayError("Could not redirect to server: " . $redirect_url->message); } else { // Send redirect. header("Location: " . $redirect_url); exit(2); } }
<?php /******************************************** * This is currently not used; ignore. * * WSM - 12/27/07 ********************************************/ require_once 'auth_common.php'; require_once 'CRM/Core/BAO/UFMatch.php'; $ar = CRM_Core_BAO_UFMatch::getContactIDs(); if (!empty($ar[0])) { header("Location:login.php"); exit(0); } $openid = $_POST['openid_url']; $firstname = $_POST['first_name']; $lastname = $_POST['last_name']; $email = $_POST['email']; //require_once 'CRM/Utils/System/Standalone.php'; $user = array('openid' => $openid, 'firstname' => $firstname, 'lastname' => $lastname, 'email' => $email); $session =& CRM_Core_Session::singleton(); $session->set('user', $user); $session->set('new_install', true); header("Location:try_auth.php?openid_url={$openid}"); exit(0);