Merge pull request #15706 from owncloud/fix-15705-master

move creation of shared key to the login handler
This commit is contained in:
Lukas Reschke 2015-04-29 09:36:34 +02:00
commit 3e06fd9342
2 changed files with 6 additions and 3 deletions

View File

@ -131,6 +131,11 @@ class KeyManager {
$this->config->setAppValue('encryption', 'publicShareKeyId', $this->publicShareKeyId); $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(); $shareKey = $this->getPublicShareKey();
if (empty($shareKey)) { if (empty($shareKey)) {
$keyPair = $this->crypt->createKeyPair(); $keyPair = $this->crypt->createKeyPair();
@ -145,9 +150,6 @@ class KeyManager {
$header = $this->crypt->generateHeader(); $header = $this->crypt->generateHeader();
$this->setSystemPrivateKey($this->publicShareKeyId, $header . $encryptedKey); $this->setSystemPrivateKey($this->publicShareKeyId, $header . $encryptedKey);
} }
$this->keyId = $userSession && $userSession->isLoggedIn() ? $userSession->getUser()->getUID() : false;
$this->log = $log;
} }
/** /**

View File

@ -79,6 +79,7 @@ class Setup {
* @return bool * @return bool
*/ */
public function setupServerSide($uid, $password) { public function setupServerSide($uid, $password) {
$this->keyManager->validateShareKey();
// Check if user already has keys // Check if user already has keys
if (!$this->keyManager->userHasKeys($uid)) { if (!$this->keyManager->userHasKeys($uid)) {
return $this->keyManager->storeKeyPair($uid, $password, return $this->keyManager->storeKeyPair($uid, $password,