/**
  * Completes the registration process of a new user by activating the account
  *
  * @return string
  */
 private function completeRegistration()
 {
     $strReturn = "";
     if ($this->getSystemid() != "") {
         $objUser = new class_module_user_user($this->getParam("systemid"));
         if ($objUser->getStrEmail() != "") {
             if ($objUser->getIntActive() == 0 && $objUser->getIntLogins() == 0 && $objUser->getStrAuthcode() == $this->getParam("authcode") && $objUser->getStrAuthcode() != "") {
                 $objUser->setIntActive(1);
                 $objUser->setStrAuthcode("");
                 if ($objUser->updateObjectToDb()) {
                     $strReturn .= $this->getLang("pr_completionSuccess");
                     if ($this->arrElementData["portalregistration_success"] != "") {
                         $this->portalReload(class_link::getLinkPortalHref($this->arrElementData["portalregistration_success"]));
                     }
                 }
             } else {
                 $strReturn .= $this->getLang("pr_completionErrorStatus");
             }
         } else {
             $strReturn .= $this->getLang("pr_completionErrorStatus");
         }
     }
     return $strReturn;
 }
예제 #2
0
 /**
  * Does all the internal login-handling
  *
  * @param class_module_user_user $objUser
  *
  * @return bool
  */
 private function internalLoginHelper(class_module_user_user $objUser)
 {
     if ($objUser->getIntActive() == 1) {
         $this->getObjInternalSession()->setStrLoginstatus(class_module_system_session::$LOGINSTATUS_LOGGEDIN);
         $this->getObjInternalSession()->setStrUserid($objUser->getSystemid());
         $strGroups = implode(",", $objUser->getArrGroupIds());
         $this->getObjInternalSession()->setStrGroupids($strGroups);
         $this->getObjInternalSession()->updateObjectToDb();
         $this->objUser = $objUser;
         //trigger listeners on first login
         if ($objUser->getIntLogins() == 0) {
             class_core_eventdispatcher::getInstance()->notifyGenericListeners(class_system_eventidentifier::EVENT_SYSTEM_USERFIRSTLOGIN, array($objUser->getSystemid()));
         }
         $objUser->setIntLogins($objUser->getIntLogins() + 1);
         $objUser->setIntLastLogin(time());
         $objUser->updateObjectToDb();
         //Drop a line to the logger
         class_logger::getInstance()->addLogRow("User: "******" successfully logged in, login provider: " . $objUser->getStrSubsystem(), class_logger::$levelInfo);
         class_module_user_log::generateLog();
         //right now we have the time to do a few cleanups...
         class_module_system_session::deleteInvalidSessions();
         //call listeners
         class_core_eventdispatcher::getInstance()->notifyGenericListeners(class_system_eventidentifier::EVENT_SYSTEM_USERLOGIN, array($objUser->getSystemid()));
         //Login successful, quit
         $bitReturn = true;
     } else {
         //User is inactive
         $bitReturn = false;
     }
     return $bitReturn;
 }