/**
  * @preserveGlobalState disabled
  */
 public function testLogin()
 {
     try {
         if (!isset($_SESSION)) {
             $_SESSION = array();
         }
         OC_RoundCube_App::login('127.0.0.1', '49080', 'roundcube', '*****@*****.**', '42');
     } catch (Exception $e) {
         echo OC_RoundCube_App::showMailFrame('127.0.0.1', '49080', 'roundcube')->getHtmlOutput();
     }
 }
Example #2
0
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*  
* You should have received a copy of the GNU Lesser General Public 
* License along with this library.  If not, see <http://www.gnu.org/licenses/>.
* 
*/
// set the passwort in session to fill the hidden login form with revertet and base64 encoded pass
// the *yourkey* must the same string as in autologin.php to replace this after revert and decode
$ocRoundCubeMailError['noUserdata'] = 'Please edit your maildata in your personal settings.';
$ocRoundCubeMailError['wrongUser'] = '******';
$ocRoundCubeMailError['noID'] = 'Ups we have a problem with your login. Please try again.';
$mailuserdata = OC_RoundCube_App::checkLoginData(OCP\User::getUser());
$mailUsername = OC_RoundCube_App::decryptMyEntry($mailuserdata['mailUser']);
$mailPassword = OC_RoundCube_App::decryptMyEntry($mailuserdata['mailPass']);
if ($mailuserdata['id'] != '') {
    if ($mailuserdata['ocUser'] == OCP\User::getUser()) {
        if ($mailuserdata['mailUser'] != '' && $mailuserdata['mailPass'] != '') {
            $maildir = OCP\Config::getAppValue('roundcube', 'maildir', '');
            OC_RoundCube_App::showMailFrame($maildir, $mailUsername, $mailPassword);
        } else {
            echo $ocRoundCubeMailError['noUserdata'];
        }
    } else {
        echo $ocRoundCubeMailError['wrongUser'];
    }
} else {
    echo $ocRoundCubeMailError['noID'];
}
Example #3
0
	}
	$rc_port = OCP\Config::getAppValue('roundcube', 'rcPort', null);

	OCP\Util::writeLog('roundcube', 'tpl.mail.php: Opening iframe for RC-host '.$rc_host.' with port '.$rc_port, OCP\Util::DEBUG);

	OCP\Util::writeLog('roundcube', 'tpl.mail.php: Preparing pre-check before rendering mail view ', OCP\Util::INFO);
	if ($mail_userdata['id'] != '') {
		if ($mail_userdata['oc_user'] == OCP\User::getUser()) {
			if (!$enable_autologin && empty($mail_userdata)) {
				OCP\Util::writeLog('roundcube', 'tpl.mail.php: No valid user login data found.', OCP\Util::ERROR);
				$html_output = $html_output . $this -> inc("part.error.no-settings");
			}
			else {
				OCP\Util::writeLog('roundcube', 'tpl.mail.php: Found valid user login data.', OCP\Util::DEBUG);
				if ($maildir != '') {
					$mailAppReturn = OC_RoundCube_App::showMailFrame($rc_host, $rc_port, $maildir);
					if ($mailAppReturn -> isErrorOccurred()) {
						OCP\Util::writeLog('roundcube', 'Not rendering roundcube iframe view due to errors', OCP\Util::ERROR);
						OCP\Util::writeLog('roundcube', 'Got the following error code: '.$mailAppReturn -> getErrorCode(),OCP\Util::ERROR);
						switch ($mailAppReturn -> getErrorCode()) {
							case OC_Mail_Object::ERROR_CODE_NETWORK :
								$html_output = $this -> inc("part.error.error-settings");
								$html_output = $html_output . $mailAppReturn -> getErrorDetails();
								break;
							case OC_Mail_Object::ERROR_CODE_LOGIN :
								$html_output = $this -> inc("part.error.wrong-auth");
								$html_output = $html_output . $mailAppReturn -> getErrorDetails();
								break;
							case OC_Mail_Object::ERROR_CODE_RC_NOT_FOUND :
								$html_output = $this -> inc("part.error.error-settings");
								$html_output = $html_output . $mailAppReturn -> getErrorDetails();