move creation of shared key to the login handler - fixes #15705

This commit is contained in:
Thomas Müller 2015-04-17 17:51:18 +02:00
parent 295839930a
commit c6e243928c
2 changed files with 6 additions and 3 deletions

View file

@ -130,6 +130,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();
@ -143,9 +148,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;
}
/**

View file

@ -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,