Exemplo n.º 1
0
 //print_r($userprofile);
 if ($userprofile instanceof Hybrid_User_Profile) {
     $email = $userprofile->email;
     $provideruid = $userprofile->identifier;
     $firstname = $userprofile->firstName;
     $lastname = $userprofile->lastName;
     $displayname = $userprofile->displayName;
     $websiteurl = $userprofile->webSiteURL;
     if (!isset($websiteurl)) {
         $websiteurl = "";
     }
     $profileurl = $userprofile->profileURL;
     $emailVerified = $userprofile->emailVerified;
     //# 1 - check if user already have authenticated using this provider before
     $auth = new UserAuthentication();
     $authentication = $auth->loadByProvider($provider, $provideruid);
     //# 2 - if authentication exists in the database, then we check the user account status
     // and if appropriate set the user as connected and redirect him
     // else display the relevant message.
     if ($authentication instanceof UserAuthentication) {
         if ($authentication->isEmailVerified()) {
             $u = new User($authentication->getUserID());
             $user = $u->load();
             if ($user instanceof User) {
                 $isEmailValidated = $user->isEmailValidated();
                 $status = $user->getStatus();
                 if ($isEmailValidated && ($status == $CFG->USER_STATUS_ACTIVE || $status == $CFG->USER_STATUS_REPORTED)) {
                     createSession($user);
                     $user->resetInvitationCode();
                     // hang over from Cohere groups code
                     header('Location: ' . $referrer);