diff options
author | Lukas Reschke <lukas@owncloud.com> | 2014-11-19 13:05:02 +0100 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2014-11-19 13:05:02 +0100 |
commit | 1c8f9564a470095134f0134f5d59fc0eece66f0e (patch) | |
tree | 68eeb0da86d79fa1de73e521193cd3505585f217 /apps/files_encryption | |
parent | dc9eaf59dcede025edccf2d90cc211d739dbf935 (diff) | |
parent | 345eb62ffaa969707fc1901d55c0674aceecea3e (diff) | |
download | nextcloud-server-1c8f9564a470095134f0134f5d59fc0eece66f0e.tar.gz nextcloud-server-1c8f9564a470095134f0134f5d59fc0eece66f0e.zip |
Merge pull request #11696 from owncloud/addWarningToEncryptionLostPassword
Warn for password reset when files_encryption is enabled
Diffstat (limited to 'apps/files_encryption')
-rw-r--r-- | apps/files_encryption/hooks/hooks.php | 13 | ||||
-rw-r--r-- | apps/files_encryption/lib/helper.php | 1 | ||||
-rw-r--r-- | apps/files_encryption/lib/util.php | 12 |
3 files changed, 26 insertions, 0 deletions
diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php index 3a0a37c0a59..eadd2b64b80 100644 --- a/apps/files_encryption/hooks/hooks.php +++ b/apps/files_encryption/hooks/hooks.php @@ -263,6 +263,19 @@ class Hooks { }
}
+ /**
+ * after password reset we create a new key pair for the user
+ *
+ * @param array $params
+ */
+ public static function postPasswordReset($params) {
+ $uid = $params['uid'];
+ $password = $params['password'];
+
+ $util = new Util(new \OC\Files\View(), $uid);
+ $util->replaceUserKeys($password);
+ }
+
/*
* check if files can be encrypted to every user.
*/
diff --git a/apps/files_encryption/lib/helper.php b/apps/files_encryption/lib/helper.php index 53c380ab2b3..7a50ade82f3 100644 --- a/apps/files_encryption/lib/helper.php +++ b/apps/files_encryption/lib/helper.php @@ -70,6 +70,7 @@ class Helper { \OCP\Util::connectHook('OC_Filesystem', 'delete', 'OCA\Encryption\Hooks', 'preDelete'); \OCP\Util::connectHook('OC_Filesystem', 'post_umount', 'OCA\Encryption\Hooks', 'postUmount'); \OCP\Util::connectHook('OC_Filesystem', 'umount', 'OCA\Encryption\Hooks', 'preUmount'); + \OCP\Util::connectHook('\OC\Core\LostPassword\Controller\LostController', 'post_passwordReset', 'OCA\Encryption\Hooks', 'postPasswordReset'); } /** diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php index c8697ae7c80..d12b003b227 100644 --- a/apps/files_encryption/lib/util.php +++ b/apps/files_encryption/lib/util.php @@ -125,6 +125,18 @@ class Util { } /** + * create a new public/private key pair for the user + * + * @param string $password password for the private key + */ + public function replaceUserKeys($password) { + $this->backupAllKeys('password_reset'); + $this->view->unlink($this->publicKeyPath); + $this->view->unlink($this->privateKeyPath); + $this->setupServerSide($password); + } + + /** * Sets up user folders and keys for serverside encryption * * @param string $passphrase to encrypt server-stored private key with |