summaryrefslogtreecommitdiffstats
path: root/apps/files_encryption/lib
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2014-10-29 12:45:13 +0100
committerLukas Reschke <lukas@owncloud.com>2014-11-17 17:50:20 +0100
commitf6efbfcf0bb76e16347748666d0c967ad839c5b2 (patch)
tree883c956761fe60e5a5ce1c5db3718103f553570a /apps/files_encryption/lib
parent11ab457b7204b68d41337794ab16b71031dd592f (diff)
downloadnextcloud-server-f6efbfcf0bb76e16347748666d0c967ad839c5b2.tar.gz
nextcloud-server-f6efbfcf0bb76e16347748666d0c967ad839c5b2.zip
listen to the post_passwordReset hook, backup the old keys and create a new key pair for the user
Diffstat (limited to 'apps/files_encryption/lib')
-rw-r--r--apps/files_encryption/lib/helper.php1
-rw-r--r--apps/files_encryption/lib/util.php12
2 files changed, 13 insertions, 0 deletions
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