first check if a private key exists, if not it is always a recovery szenario

This commit is contained in:
Bjoern Schiessle 2014-09-22 15:04:55 +02:00
parent 831d34f084
commit 744110905b

View file

@ -191,14 +191,13 @@ class Hooks {
if (Crypt::mode() === 'server') {
$view = new \OC\Files\View('/');
if ($params['uid'] === \OCP\User::getUser()) {
$session = new \OCA\Encryption\Session($view);
// Get existing decrypted private key
$privateKey = $session->getPrivateKey();
if ($params['uid'] === \OCP\User::getUser() && $privateKey) {
// Encrypt private key with new user pwd as passphrase
$encryptedPrivateKey = Crypt::symmetricEncryptFileContent($privateKey, $params['password'], Helper::getCipher());