diff options
author | Lukas Reschke <lukas@owncloud.com> | 2015-04-29 09:36:34 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2015-04-29 09:36:34 +0200 |
commit | 3e06fd934238f345220254e4b197f11413421912 (patch) | |
tree | 28e1d1ab94f950826580bc80f245fcc99d09b9a2 /apps/encryption/lib | |
parent | fa6cb494ed3f5563a0d6feb1e0c41d4929b8a95d (diff) | |
parent | c6e243928c1dca7995202178aaddc919fe4d40ed (diff) | |
download | nextcloud-server-3e06fd934238f345220254e4b197f11413421912.tar.gz nextcloud-server-3e06fd934238f345220254e4b197f11413421912.zip |
Merge pull request #15706 from owncloud/fix-15705-master
move creation of shared key to the login handler
Diffstat (limited to 'apps/encryption/lib')
-rw-r--r-- | apps/encryption/lib/keymanager.php | 8 | ||||
-rw-r--r-- | apps/encryption/lib/users/setup.php | 1 |
2 files changed, 6 insertions, 3 deletions
diff --git a/apps/encryption/lib/keymanager.php b/apps/encryption/lib/keymanager.php index 1e6f3d29be8..bde8212e9dc 100644 --- a/apps/encryption/lib/keymanager.php +++ b/apps/encryption/lib/keymanager.php @@ -131,6 +131,11 @@ class KeyManager { $this->config->setAppValue('encryption', 'publicShareKeyId', $this->publicShareKeyId); } + $this->keyId = $userSession && $userSession->isLoggedIn() ? $userSession->getUser()->getUID() : false; + $this->log = $log; + } + + public function validateShareKey() { $shareKey = $this->getPublicShareKey(); if (empty($shareKey)) { $keyPair = $this->crypt->createKeyPair(); @@ -145,9 +150,6 @@ class KeyManager { $header = $this->crypt->generateHeader(); $this->setSystemPrivateKey($this->publicShareKeyId, $header . $encryptedKey); } - - $this->keyId = $userSession && $userSession->isLoggedIn() ? $userSession->getUser()->getUID() : false; - $this->log = $log; } /** diff --git a/apps/encryption/lib/users/setup.php b/apps/encryption/lib/users/setup.php index 2ec49b5c7fb..fd8261cc637 100644 --- a/apps/encryption/lib/users/setup.php +++ b/apps/encryption/lib/users/setup.php @@ -79,6 +79,7 @@ class Setup { * @return bool */ public function setupServerSide($uid, $password) { + $this->keyManager->validateShareKey(); // Check if user already has keys if (!$this->keyManager->userHasKeys($uid)) { return $this->keyManager->storeKeyPair($uid, $password, |