From f52be6fb66025add26ec212c84c1608f8fc4f391 Mon Sep 17 00:00:00 2001 From: RainLoop Team Date: Fri, 11 Apr 2014 21:49:00 +0400 Subject: [PATCH] CpanelAutoLogin service --- .../app/libraries/RainLoop/ServiceActions.php | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/ServiceActions.php b/rainloop/v/0.0.0/app/libraries/RainLoop/ServiceActions.php index c3b79c392..ddc4f056c 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/ServiceActions.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/ServiceActions.php @@ -820,6 +820,37 @@ class ServiceActions } } + /** + * @return string + */ + public function ServiceCpanelAutoLogin() + { + $oException = null; + $oAccount = null; + + $sEmail = $this->oHttp->GetEnv('REMOTE_USER', ''); + $sLogin = ''; + $sPassword = $this->oHttp->GetEnv('REMOTE_PASSWORD', ''); + + if (0 < \strlen($sEmail) && 0 < \strlen(\trim($sPassword))) + { + try + { + $this->oActions->Logger()->AddSecret($sPassword); + + $oAccount = $this->oActions->LoginProcess($sEmail, $sLogin, $sPassword); + $this->oActions->AuthProcess($oAccount); + } + catch (\Exception $oException) + { + $this->oActions->Logger()->WriteException($oException); + } + } + + $this->oActions->Location('./'); + return ''; + } + /** * @return string */