Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2013-07-29 19:06:05 +0400
committerBjoern Schiessle <schiessle@owncloud.com>2013-07-29 19:06:05 +0400
commitb6fa0e4eefb332dc1fb9b45df50de4621ed8e6bd (patch)
tree2ca892180568bd5c76facbfd9e6762621485a5dd /settings/ajax
parent830f5d24c77b863bd49eda0cbc4ba812add8065d (diff)
working decrypt files method
Diffstat (limited to 'settings/ajax')
-rw-r--r--settings/ajax/decryptall.php23
1 files changed, 15 insertions, 8 deletions
diff --git a/settings/ajax/decryptall.php b/settings/ajax/decryptall.php
index 02a9bfe96b1..7adacb9802a 100644
--- a/settings/ajax/decryptall.php
+++ b/settings/ajax/decryptall.php
@@ -1,14 +1,21 @@
<?php
+sleep(10);
+//encryption app needs to be loaded
+OC_App::loadApp('files_encryption');
-$status = OC_App::isEnabled('files_encryption');
-OC_App::enable('files_encryption');
+// init encryption app
+$params = array('uid' => \OCP\User::getUser(),
+ 'password' => $_POST['password']);
-OCA\Encryption\Crypt::decryptAll();
-
-if ($status === false) {
- OC_App::disable('files_encryption');
-}
+$view = new OC_FilesystemView('/');
+$util = new \OCA\Encryption\Util($view, \OCP\User::getUser());
+$result = $util->initEncryption($params);
-\OCP\JSON::success(array('data' => array('message' => 'looks good')));
+if ($result !== false) {
+ $util->decryptAll();
+ \OCP\JSON::success(array('data' => array('message' => 'Files decrypted successfully')));
+} else {
+ \OCP\JSON::error(array('data' => array('message' => 'Couldn\'t decrypt files, check your password and try again')));
+}