Пример #1
0
 /**
  * @param bool $bAdmin = true
  *
  * @return string
  */
 private function localAppData($bAdmin = false)
 {
     @\header('Content-Type: application/javascript; charset=utf-8');
     $this->oHttp->ServerNoCache();
     $sAuthAccountHash = '';
     if (!$bAdmin && 0 === \strlen($this->oActions->GetSpecAuthLogoutTokenWithDeletion())) {
         $sAuthAccountHash = $this->oActions->GetSpecAuthTokenWithDeletion();
         if (empty($sAuthAccountHash)) {
             $sAuthAccountHash = $this->oActions->GetSpecAuthToken();
         }
         if (empty($sAuthAccountHash)) {
             $oAccount = $this->oActions->GetAccountFromSignMeToken();
             if ($oAccount) {
                 try {
                     $this->oActions->CheckMailConnection($oAccount);
                     $this->oActions->AuthToken($oAccount);
                     $sAuthAccountHash = $this->oActions->GetSpecAuthToken();
                 } catch (\Exception $oException) {
                     $oException = null;
                     $this->oActions->ClearSignMeData($oAccount);
                 }
             }
         }
         $this->oActions->SetSpecAuthToken($sAuthAccountHash);
     }
     $sResult = $this->compileAppData($this->oActions->AppData($bAdmin, $sAuthAccountHash), false);
     $this->Logger()->Write($sResult, \MailSo\Log\Enumerations\Type::INFO, 'APPDATA');
     return $sResult;
 }
Пример #2
0
 /**
  * @param \RainLoop\Model\Account|null $oAccount
  * @param string $sEmail
  * @param string $sPassword
  *
  * @return int
  */
 private function loginProcess(&$oAccount, $sEmail, $sPassword)
 {
     $iErrorCode = \RainLoop\Notifications::UnknownError;
     try {
         $oAccount = $this->oActions->LoginProcess($sEmail, $sPassword);
         if ($oAccount instanceof \RainLoop\Model\Account) {
             $this->oActions->AuthToken($oAccount);
             $iErrorCode = 0;
         } else {
             $oAccount = null;
             $iErrorCode = \RainLoop\Notifications::AuthError;
         }
     } catch (\RainLoop\Exceptions\ClientException $oException) {
         $iErrorCode = $oException->getCode();
     } catch (\Exception $oException) {
         unset($oException);
         $iErrorCode = \RainLoop\Notifications::UnknownError;
     }
     return $iErrorCode;
 }