Squashed commit of the following:

commit 1345201c9da99a82f198e41fba24da6b0d7ae59a
Author: Björn Schießle <schiessle@owncloud.com>
Date:   Thu Jun 20 16:27:46 2013 +0200

    add l10n support

commit bf2c79c8de8710e839a4a55642a91874c374fa1c
Author: Björn Schießle <schiessle@owncloud.com>
Date:   Thu Jun 20 16:19:10 2013 +0200

    only init session if openssl extension is loaded

commit cbd52af6afbaa310bb1a534db64ff5e476dfd5d7
Author: Björn Schießle <schiessle@owncloud.com>
Date:   Thu Jun 20 12:25:40 2013 +0200

    first disable app and than show error page

commit 55baf593179c433642de59552592e6b0f1932880
Author: Björn Schießle <schiessle@owncloud.com>
Date:   Thu Jun 20 12:17:34 2013 +0200

    typo fixed

commit 1d9bef0b058e7cc3d511b81ae12d5a07660c75b2
Author: Björn Schießle <schiessle@owncloud.com>
Date:   Thu Jun 20 12:15:40 2013 +0200

    move dependency check to the encryption app

commit c186e95da526f0470e20f014f1bd9513db5518ff
Author: Björn Schießle <schiessle@owncloud.com>
Date:   Thu Jun 20 11:13:11 2013 +0200

    make sure that openssl is installed and loaded
This commit is contained in:
Björn Schießle 2013-06-21 10:37:51 +02:00
parent 8c923a85de
commit d10ad0d603
2 changed files with 18 additions and 9 deletions

View File

@ -33,13 +33,18 @@ if (!OC_Config::getValue('maintenance', false)) {
} }
$view = new OC_FilesystemView('/'); $view = new OC_FilesystemView('/');
$session = new \OCA\Encryption\Session($view);
$sessionReady = false;
if(extension_loaded("openssl")) {
$session = new \OCA\Encryption\Session($view);
$sessionReady = true;
}
$user = \OCP\USER::getUser(); $user = \OCP\USER::getUser();
// check if user has a private key // check if user has a private key
if ( if ($sessionReady === false
!$view->file_exists('/' . $user . '/files_encryption/' . $user . '.private.key') || (!$view->file_exists('/' . $user . '/files_encryption/' . $user . '.private.key')
&& OCA\Encryption\Crypt::mode() === 'server' && OCA\Encryption\Crypt::mode() === 'server')
) { ) {
// Force the user to log-in again if the encryption key isn't unlocked // Force the user to log-in again if the encryption key isn't unlocked

View File

@ -38,11 +38,15 @@ class Hooks {
* @note This method should never be called for users using client side encryption * @note This method should never be called for users using client side encryption
*/ */
public static function login($params) { public static function login($params) {
$l = new \OC_L10N('files_encryption');
// Manually initialise Filesystem{} singleton with correct //check if openssl is available
// fake root path, in order to avoid fatal webdav errors if(!extension_loaded("openssl") ) {
// NOTE: disabled because this give errors on webdav! $error_msg = $l->t("PHP module OpenSSL is not installed.");
//\OC\Files\Filesystem::init( $params['uid'], '/' . 'files' . '/' ); $hint = $l->t('Please ask your server administrator to install the module. For now the encryption app was disabled.');
\OC_App::disable('files_encryption');
\OCP\Util::writeLog('Encryption library', $error_msg . ' ' . $hint, \OCP\Util::ERROR);
\OCP\Template::printErrorPage($error_msg, $hint);
}
$view = new \OC_FilesystemView('/'); $view = new \OC_FilesystemView('/');