Commit ff6c5331 authored by Lukas Reschke's avatar Lukas Reschke
Browse files

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
parents 4c39139b 74411090
......@@ -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());
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment