diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2013-07-29 17:06:05 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2013-07-29 17:06:05 +0200 |
commit | b6fa0e4eefb332dc1fb9b45df50de4621ed8e6bd (patch) | |
tree | 2ca892180568bd5c76facbfd9e6762621485a5dd /settings/ajax | |
parent | 830f5d24c77b863bd49eda0cbc4ba812add8065d (diff) | |
download | nextcloud-server-b6fa0e4eefb332dc1fb9b45df50de4621ed8e6bd.tar.gz nextcloud-server-b6fa0e4eefb332dc1fb9b45df50de4621ed8e6bd.zip |
working decrypt files method
Diffstat (limited to 'settings/ajax')
-rw-r--r-- | settings/ajax/decryptall.php | 23 |
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'))); +} |