run setup routine only for server side encryption

This commit is contained in:
Bjoern Schiessle 2012-07-27 13:58:58 +02:00
parent bb229f7291
commit 931c4695a6
1 changed files with 20 additions and 16 deletions

View File

@ -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;
}
}