diff options
author | Björn Schießle <bjoern@schiessle.org> | 2013-08-18 09:51:48 -0700 |
---|---|---|
committer | Björn Schießle <bjoern@schiessle.org> | 2013-08-18 09:51:48 -0700 |
commit | 9be836814cb4165ea54a086a0f97526d783bcd37 (patch) | |
tree | ad57d30194571edcf0f51cd83178b8ac2f03c0aa /settings/ajax | |
parent | c620c5840ab8ca45531c7639e086bafbd87d7365 (diff) | |
parent | d544a371bfb84f36a3b789d19d44d6694de21c48 (diff) | |
download | nextcloud-server-9be836814cb4165ea54a086a0f97526d783bcd37.tar.gz nextcloud-server-9be836814cb4165ea54a086a0f97526d783bcd37.zip |
Merge pull request #4239 from owncloud/decrypt_files_again
Enable user to decrypt files again after encryption app was disabled
Diffstat (limited to 'settings/ajax')
-rw-r--r-- | settings/ajax/decryptall.php | 25 |
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'))); +} + |