summaryrefslogtreecommitdiffstats
path: root/apps/files_encryption/files
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2013-10-11 14:20:46 +0200
committerBjoern Schiessle <schiessle@owncloud.com>2013-10-11 14:20:46 +0200
commit39d710e737da31111f62b44abf30b0be95246c99 (patch)
treeb2eefe4f0800be7dc1caab4b8be1c74dae452457 /apps/files_encryption/files
parent4336d42ab095c304d0a46bb30c2d0203e606597e (diff)
downloadnextcloud-server-39d710e737da31111f62b44abf30b0be95246c99.tar.gz
nextcloud-server-39d710e737da31111f62b44abf30b0be95246c99.zip
block file access if share keys are missing
Diffstat (limited to 'apps/files_encryption/files')
-rw-r--r--apps/files_encryption/files/error.php25
1 files changed, 19 insertions, 6 deletions
diff --git a/apps/files_encryption/files/error.php b/apps/files_encryption/files/error.php
index ac0c0269164..b59b7b8e672 100644
--- a/apps/files_encryption/files/error.php
+++ b/apps/files_encryption/files/error.php
@@ -5,12 +5,25 @@ if (!isset($_)) { //also provide standalone error page
$l = OC_L10N::get('files_encryption');
- if (isset($_GET['i']) && $_GET['i'] === '0') {
- $errorMsg = $l->t('Encryption app not initialized! Maybe the encryption app was re-enabled during your session. Please try to log out and log back in to initialize the encryption app.');
- $init = '0';
+ if (isset($_GET['errorCode'])) {
+ $errorCode = $_GET['errorCode'];
+ switch ($errorCode) {
+ case \OCA\Encryption\Crypt::ENCRYPTION_NOT_INITIALIZED_ERROR:
+ $errorMsg = $l->t('Encryption app not initialized! Maybe the encryption app was re-enabled during your session. Please try to log out and log back in to initialize the encryption app.');
+ break;
+ case \OCA\Encryption\Crypt::ENCRYPTION_PRIVATE_KEY_NOT_VALID_ERROR:
+ $errorMsg = $l->t('Your private key is not valid! Likely your password was changed outside the ownCloud system (e.g. your corporate directory). You can update your private key password in your personal settings to recover access to your encrypted files.');
+ break;
+ case \OCA\Encryption\Crypt::ENCRYPTION_NO_SHARE_KEY_FOUND:
+ $errorMsg = $l->t('Can not decrypt this file, probably this is a shared file. Please ask the file owner to reshare the file with you.');
+ break;
+ default:
+ $errorMsg = $l->t("Unknwon error please check your system settings or contact your administrator");
+ break;
+ }
} else {
- $errorMsg = $l->t('Your private key is not valid! Likely your password was changed outside the ownCloud system (e.g. your corporate directory). You can update your private key password in your personal settings to recover access to your encrypted files.');
- $init = '1';
+ $errorCode = \OCA\Encryption\Crypt::ENCRYPTION_UNKNOWN_ERROR;
+ $errorMsg = $l->t("Unknwon error please check your system settings or contact your administrator");
}
if (isset($_GET['p']) && $_GET['p'] === '1') {
@@ -24,7 +37,7 @@ if (!isset($_)) { //also provide standalone error page
header('HTTP/1.0 404 ' . $errorMsg);
$tmpl = new OC_Template('files_encryption', 'invalid_private_key', 'guest');
$tmpl->assign('message', $errorMsg);
- $tmpl->assign('init', $init);
+ $tmpl->assign('errorCode', $errorCode);
$tmpl->printPage();
}