diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2012-07-27 13:58:58 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2012-07-27 13:58:58 +0200 |
commit | 931c4695a60d7c46d225152f0628fdd7f1574027 (patch) | |
tree | 71b3b96d3d5fa69cc34d5b6c0552cfb8e21308a2 /apps/files_encryption/hooks/hooks.php | |
parent | bb229f729114bcd20b861e8b118fd6c805b96b73 (diff) | |
download | nextcloud-server-931c4695a60d7c46d225152f0628fdd7f1574027.tar.gz nextcloud-server-931c4695a60d7c46d225152f0628fdd7f1574027.zip |
run setup routine only for server side encryption
Diffstat (limited to 'apps/files_encryption/hooks/hooks.php')
-rw-r--r-- | apps/files_encryption/hooks/hooks.php | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php index 654686208fa..80daf50a24d 100644 --- a/apps/files_encryption/hooks/hooks.php +++ b/apps/files_encryption/hooks/hooks.php @@ -34,24 +34,28 @@ class Hooks { * @brief Startup encryption backend upon user login * @note This method should never be called for users using client side encryption */ - public static function login( $params ){ - - $view = new \OC_FilesystemView( '/' ); - - $util = new Util( $view, $params['uid'] ); - - if ( !$util->ready() ) { - - return $util->setup( $params['password'] ); - + + public static function login( $params ) { + + if (Crypt::mode($params['uid'])=='server') { + + $view = new \OC_FilesystemView( '/' ); + + $util = new Util( $view, $params['uid'] ); + + if ( !$util->ready()) { + + return $util->setupServerSide( $params['password'] ); + + } + + $encryptedKey = Keymanager::getPrivateKey( $params['uid'] ); + + $_SESSION['enckey'] = Crypt::symmetricEncryptFileContent( $encryptedKey, $params['password'] ); } - - $encryptedKey = Keymanager::getPrivateKey( $params['uid'] ); - - $_SESSION['enckey'] = Crypt::symmetricEncryptFileContent( $encryptedKey, $params['password'] ); - + return true; - + } } |