summaryrefslogtreecommitdiffstats
path: root/settings/ajax/decryptall.php
diff options
context:
space:
mode:
Diffstat (limited to 'settings/ajax/decryptall.php')
-rw-r--r--settings/ajax/decryptall.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/settings/ajax/decryptall.php b/settings/ajax/decryptall.php
new file mode 100644
index 00000000000..e53067931e8
--- /dev/null
+++ b/settings/ajax/decryptall.php
@@ -0,0 +1,25 @@
+<?php
+
+//encryption app needs to be loaded
+OC_App::loadApp('files_encryption');
+
+// init encryption app
+$params = array('uid' => \OCP\User::getUser(),
+ 'password' => $_POST['password']);
+
+$view = new OC_FilesystemView('/');
+$util = new \OCA\Encryption\Util($view, \OCP\User::getUser());
+
+$result = $util->initEncryption($params);
+
+if ($result !== false) {
+ $successful = $util->decryptAll();
+ if ($successful === true) {
+ \OCP\JSON::success(array('data' => array('message' => 'Files decrypted successfully')));
+ } else {
+ \OCP\JSON::error(array('data' => array('message' => 'Couldn\'t decrypt your files, please check your owncloud.log or ask your administrator')));
+ }
+} else {
+ \OCP\JSON::error(array('data' => array('message' => 'Couldn\'t decrypt your files, check your password and try again')));
+}
+