diff options
Diffstat (limited to 'settings/changepassword/controller.php')
-rw-r--r-- | settings/changepassword/controller.php | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/settings/changepassword/controller.php b/settings/changepassword/controller.php index 1be30b725df..f041cb5b29f 100644 --- a/settings/changepassword/controller.php +++ b/settings/changepassword/controller.php @@ -77,16 +77,43 @@ class Controller { exit(); } - if (\OC_App::isEnabled('files_encryption')) { + if (\OC_App::isEnabled('encryption')) { //handle the recovery case - $util = new \OCA\Files_Encryption\Util(new \OC\Files\View('/'), $username); - $recoveryAdminEnabled = \OC_Appconfig::getValue('files_encryption', 'recoveryAdminEnabled'); + $crypt = new \OCA\Encryption\Crypto\Crypt( + \OC::$server->getLogger(), + \OC::$server->getUserSession(), + \OC::$server->getConfig()); + $keyStorage = \OC::$server->getEncryptionKeyStorage(\OCA\Encryption\Crypto\Encryption::ID); + $util = new \OCA\Encryption\Util( + new \OC\Files\View(), + $crypt, + \OC::$server->getLogger(), + \OC::$server->getUserSession(), + \OC::$server->getConfig()); + $keyManager = new \OCA\Encryption\KeyManager( + $keyStorage, + $crypt, + \OC::$server->getConfig(), + \OC::$server->getUserSession(), + new \OCA\Encryption\Session(\OC::$server->getSession()), + \OC::$server->getLogger(), + $util); + $recovery = new \OCA\Encryption\Recovery( + \OC::$server->getUserSession(), + $crypt, + \OC::$server->getSecureRandom(), + $keyManager, + \OC::$server->getConfig(), + $keyStorage, + \OC::$server->getEncryptionFilesHelper(), + new \OC\Files\View()); + $recoveryAdminEnabled = $recovery->isRecoveryKeyEnabled(); $validRecoveryPassword = false; $recoveryEnabledForUser = false; if ($recoveryAdminEnabled) { - $validRecoveryPassword = $util->checkRecoveryPassword($recoveryPassword); - $recoveryEnabledForUser = $util->recoveryEnabledForUser(); + $validRecoveryPassword = $keyManager->checkRecoveryPassword($recoveryPassword); + $recoveryEnabledForUser = $recovery->isRecoveryEnabledForUser(); } if ($recoveryEnabledForUser && $recoveryPassword === '') { |