/** * @param \RainLoop\Account $oAccount * @param string $sPrevPassword * @param string $sNewPassword */ public function ChangePassword(\RainLoop\Account $oAccount, $sPrevPassword, $sNewPassword) { $mResult = false; if ($this->oDriver instanceof \RainLoop\Providers\ChangePassword\ChangePasswordInterface && $this->PasswordChangePossibility($oAccount)) { if ($sPrevPassword !== $oAccount->Password()) { throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::CurrentPasswordIncorrect); } $sPasswordForCheck = \trim($sNewPassword); if (6 > \strlen($sPasswordForCheck)) { throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::NewPasswordShort); } if (!\MailSo\Base\Utils::PasswordWeaknessCheck($sPasswordForCheck)) { throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::NewPasswordWeak); } if (!$this->oDriver->ChangePassword($oAccount, $sPrevPassword, $sNewPassword)) { throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::CouldNotSaveNewPassword); } $oAccount->SetPassword($sNewPassword); $this->oActions->SetAuthToken($oAccount); $mResult = $this->oActions->GetSpecAuthToken(); } else { throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::CouldNotSaveNewPassword); } return $mResult; }
/** * @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; }
/** * @param \RainLoop\Account|null $oAccount = null * * @return \RainLoop\Common\RainLoopFacebookRedirectLoginHelper|null */ public function FacebookConnector($oAccount = null) { $oFacebook = false; $oConfig = $this->oActions->Config(); $sAppID = \trim($oConfig->Get('social', 'fb_app_id', '')); if (\version_compare(PHP_VERSION, '5.4.0', '>=') && $oConfig->Get('social', 'fb_enable', false) && '' !== $sAppID && '' !== \trim($oConfig->Get('social', 'fb_app_secret', ''))) { \Facebook\FacebookSession::setDefaultApplication($sAppID, \trim($oConfig->Get('social', 'fb_app_secret', ''))); $sRedirectUrl = $this->oHttp->GetFullUrl() . '?SocialFacebook'; if (0 < \strlen($this->oActions->GetSpecAuthToken())) { $sRedirectUrl .= '&rlah=' . $this->oActions->GetSpecAuthToken(); } else { if ($this->oHttp->HasQuery('rlah')) { $this->oActions->SetSpecAuthToken($this->oHttp->GetQuery('rlah', '')); $sRedirectUrl .= '&rlah=' . $this->oActions->GetSpecAuthToken(); } } try { $oAccount = $this->oActions->GetAccount(); $oFacebook = new \RainLoop\Common\RainLoopFacebookRedirectLoginHelper($sRedirectUrl); $oFacebook->initRainLoopData(array('rlAppId' => $sAppID, 'rlAccount' => $oAccount, 'rlUserHash' => \RainLoop\Utils::GetConnectionToken(), 'rlStorageProvaider' => $this->oActions->StorageProvider())); } catch (\Exception $oException) { $this->oActions->Logger()->WriteException($oException, \MailSo\Log\Enumerations\Type::ERROR); } } return false === $oFacebook ? null : $oFacebook; }