예제 #1
0
     }
     if (!empty($usersFound)) {
         $usersFound[0]->loginCurrent();
         array_shift($userIDs);
         //TODO: Enable user to choose which account to login to
         //if more than one is found connected to provided social
         //network account
     } else {
         eZUser::logoutCurrent();
     }
 } else {
     // no previously connected accounts, try to find existing social network account
     $user = eZUser::fetchByName('ngconnect_' . $result['login_method'] . '_' . $result['id']);
     if ($user instanceof eZUser) {
         if ($user->isEnabled() && $user->canLoginToSiteAccess($GLOBALS['eZCurrentAccess'])) {
             ngConnectFunctions::updateUser($user, $result);
             $user->loginCurrent();
         } else {
             eZUser::logoutCurrent();
         }
     } else {
         // we didn't find any social network accounts, create new account
         // redirect to ngconnect/profile if enabled
         $forceRedirect = false;
         if (eZUser::requireUniqueEmail() && eZUser::fetchByEmail($result['email']) instanceof eZUser && trim($ngConnectINI->variable('ngconnect', 'DuplicateEmailForceRedirect')) == 'enabled') {
             $forceRedirect = true;
         }
         if ($regularRegistration || $forceRedirect) {
             if (!$regularRegistration && $forceRedirect) {
                 $http->setSessionVariable('NGConnectForceRedirect', 'true');
             }