aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2014-09-23 10:13:58 +0200
committerLukas Reschke <lukas@owncloud.com>2014-09-23 10:13:58 +0200
commitff6c5331e991bb33fee3777649f20c5824ab44e4 (patch)
treedf340bb9ace03a09a47408754a61d63e26dc2c8f
parent4c39139bd2b67c2208ebaf13d785676ecdc19c27 (diff)
parent744110905b131998be1dda9f23042572436dfe51 (diff)
downloadnextcloud-server-ff6c5331e991bb33fee3777649f20c5824ab44e4.tar.gz
nextcloud-server-ff6c5331e991bb33fee3777649f20c5824ab44e4.zip
Merge pull request #11224 from owncloud/fix_recovery_admin_user
first check if a private key exists, if not it is always a recovery szenario
-rw-r--r--apps/files_encryption/hooks/hooks.php9
1 files changed, 4 insertions, 5 deletions
diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php
index a6b4882083b..8eda8ef0881 100644
--- a/apps/files_encryption/hooks/hooks.php
+++ b/apps/files_encryption/hooks/hooks.php
@@ -191,13 +191,12 @@ class Hooks {
if (Crypt::mode() === 'server') {
$view = new \OC\Files\View('/');
+ $session = new \OCA\Encryption\Session($view);
- if ($params['uid'] === \OCP\User::getUser()) {
+ // Get existing decrypted private key
+ $privateKey = $session->getPrivateKey();
- $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());