Exemplo n.º 1
0
 if ($CFG->signupstatus == $CFG->SIGNUP_OPEN) {
     $name = $firstname;
     if ($name != "") {
         if ($lastname != "") {
             $name .= " " . $lastname;
         }
     } else {
         $name = $displayname;
     }
     // If it is an open SIGNUP system, automatically create them a user account.
     $u = new User();
     $user = $u->add($email, $name, "", $websiteurl, 'N', $provider);
     if ($user instanceof USER) {
         $registrationKey = $user->getRegistrationKey();
         $authentication = new UserAuthentication();
         $authentication->add($user->userid, $provider, $provideruid, $email, $registrationKey);
         // Check to see if the external provider has verified the email address.
         // If we are happy that they have, we trust that they are who they say.
         // So complete the registration process automatically and set the email addresses as validated.
         if ($email == $emailVerified) {
             $user->completeRegistration($registrationKey);
             $authentication->completeVerification($registrationKey);
             // send completion email to user
             $paramArray = array($user->name, $CFG->SITE_TITLE, $LNG->WELCOME_REGISTER_OPEN_BODY);
             sendMail("welcome", $LNG->WELCOME_REGISTER_OPEN_SUBJECT, $user->getEmail(), $paramArray);
             createSession($user);
             header('Location: ' . $CFG->homeAddress . '/ui/pages/welcomeexternal.php?provider=' . $provider . "&referer=" . $referrer);
         } else {
             // send email for validate ownership of email given, Validate email as External.
             $paramArray = array($user->name, $CFG->SITE_TITLE, $CFG->homeAddress, $user->userid, $authentication->authid, $registrationKey, urlencode($referrer));
             sendMail("validateexternalnewuser", $LNG->VALIDATE_REGISTER_SUBJECT, $user->getEmail(), $paramArray);