/**
  * @preserveGlobalState disabled
  */
 public function testConnectionError()
 {
     try {
         $rcLogin = new OC_RoundCube_Login('127.0.0.1', '49080', 'roundcube/', true, true, true);
         $rcLogin->login("*****@*****.**", "42");
     } catch (Exception $e) {
         print $e;
     }
 }
Exemplo n.º 2
0
 public function testConnectionError()
 {
     $rcLogin = new OC_RoundCube_Login('localhost', '443', 'mail');
     try {
         $rcLogin->login("user", "password");
     } catch (OC_Mail_NetworkingException $expected) {
         return;
     }
     $this->fail('An expected exception has not been raised.');
 }
 public function testConnectionError()
 {
     $rcLogin = new OC_RoundCube_Login('localhost', '4443', 'mail');
     try {
         $rcLogin->login("user", "password");
         $this->assertFalse($rcLogin->isLoggedIn(), 'Should not be logged in', true, true, true);
     } catch (OC_Mail_NetworkingException $expected) {
         return;
     }
     $this->fail('An expected exception has not been raised.');
 }
Exemplo n.º 4
0
 /**
  * Login to roundcube host
  *
  * @param
  *            roundcube host to use $rcHost
  * @param
  *            port of the roundcube server $rcPort
  * @param
  *            context path of roundcube $maildir
  * @param
  *            login to be used $pLogin
  * @param
  *            password to be used $pPassword
  */
 public static function login($rcHost, $rcPort, $maildir, $pLogin, $pPassword)
 {
     // Create RC login object.
     $enableDebug = OCP\Config::getAppValue('roundcube', 'enableDebug', false);
     $disableSSLverify = OCP\Config::getAppValue('roundcube', 'noSSLverify', false);
     $rcl = new OC_RoundCube_Login($rcHost, $rcPort, $maildir, $disableSSLverify, $enableDebug, false);
     // Try to login
     $rcl->login($pLogin, $pPassword);
     OCP\Util::writeLog('roundcube', 'OC_RoundCube_App.class.php->login(): Trying to log into roundcube webinterface under ' . $maildir . ' as user ' . $pLogin, OCP\Util::DEBUG);
     if ($rcl->isLoggedIn()) {
         // save roundcube session ID to Session
         self::setSessionVariable(self::SESSION_ATTR_RCSESSID, $rcl->getSessionID());
         self::setSessionVariable(self::SESSION_ATTR_RCSESSAUTH, $rcl->getSessionAuth());
         OCP\Util::writeLog('roundcube', 'OC_RoundCube_App.class.php->login(): ' . $pLogin . ' already logged into roundcube with session ID ' . $rcl->getSessionID(), OCP\Util::DEBUG);
         return true;
     } else {
         $rcl->login($pLogin, $pPassword);
         if ($rcl->isLoggedIn()) {
             // save roundcube session ID to Session
             self::setSessionVariable(self::SESSION_ATTR_RCSESSID, $rcl->getSessionID());
             self::setSessionVariable(self::SESSION_ATTR_RCSESSAUTH, $rcl->getSessionAuth());
             OCP\Util::writeLog('roundcube', 'OC_RoundCube_App.class.php->login(): ' . $pLogin . ' successfully logged into roundcube with session ID ' . $rcl->getSessionID(), OCP\Util::DEBUG);
             return true;
         } else {
             // If the login fails, display an error message in the loggs
             OCP\Util::writeLog('roundcube', 'OC_RoundCube_App.class.php->login(): ' . $pLogin . ': RoundCube can\'t login to roundcube due to a login error to roundcube', OCP\Util::ERROR);
             return false;
         }
     }
 }
Exemplo n.º 5
0
 /**
  * Login to roundcube host
  *
  * @param roundcube host to use $rcHost
  * @param port of the roundcube server $rcPort
  * @param context path of roundcube $maildir
  * @param login to be used $pLogin
  * @param password to be used $pPassword
  */
 public static function login($rcHost, $rcPort, $maildir, $pLogin, $pPassword)
 {
     // Create RC login object.
     $enableDebug = OCP\Config::getAppValue('roundcube', 'enableDebug', 'true');
     $rcl = new OC_RoundCube_Login($rcHost, $rcPort, $maildir, $enableDebug);
     // Try to login
     OCP\Util::writeLog('roundcube', 'OC_RoundCube_App.class.php->login(): Trying to log into roundcube webinterface under ' . $maildir . ' as user ' . $pLogin, OCP\Util::DEBUG);
     if ($rcl->isLoggedIn()) {
         $rcl->logout();
         $rcl = new OC_RoundCube_Login($rcHost, $rcPort, $maildir, $enableDebug);
     }
     if ($rcl->login($pLogin, $pPassword)) {
         OCP\Util::writeLog('roundcube', 'OC_RoundCube_App.class.php->login(): ' . $pLogin . ' successfully logged into roundcube ', OCP\Util::INFO);
     } else {
         // If the login fails, display an error message in the loggs
         OCP\Util::writeLog('roundcube', 'OC_RoundCube_App.class.php->login(): ' . $pLogin . ': RoundCube can\'t login to roundcube due to a login error to roundcube', OCP\Util::ERROR);
     }
 }