summaryrefslogtreecommitdiffstats
path: root/apps/files_encryption/lib/helper.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_encryption/lib/helper.php')
-rwxr-xr-xapps/files_encryption/lib/helper.php20
1 files changed, 16 insertions, 4 deletions
diff --git a/apps/files_encryption/lib/helper.php b/apps/files_encryption/lib/helper.php
index ebfc00157f7..a754f9f28c4 100755
--- a/apps/files_encryption/lib/helper.php
+++ b/apps/files_encryption/lib/helper.php
@@ -235,16 +235,28 @@ class Helper {
/**
* @brief redirect to a error page
*/
- public static function redirectToErrorPage($session) {
-
- $init = $session->getInitialized();
+ public static function redirectToErrorPage($session, $errorCode = null) {
+
+ if ($errorCode === null) {
+ $init = $session->getInitialized();
+ switch ($init) {
+ case \OCA\Encryption\Session::INIT_EXECUTED:
+ $errorCode = \OCA\Encryption\Crypt::ENCRYPTION_PRIVATE_KEY_NOT_VALID_ERROR;
+ break;
+ case \OCA\Encryption\Session::NOT_INITIALIZED:
+ $errorCode = \OCA\Encryption\Crypt::ENCRYPTION_NOT_INITIALIZED_ERROR;
+ break;
+ default:
+ $errorCode = \OCA\Encryption\Crypt::ENCRYPTION_UNKNOWN_ERROR;
+ }
+ }
$location = \OC_Helper::linkToAbsolute('apps/files_encryption/files', 'error.php');
$post = 0;
if(count($_POST) > 0) {
$post = 1;
}
- header('Location: ' . $location . '?p=' . $post . '&i=' . $init);
+ header('Location: ' . $location . '?p=' . $post . '&errorCode=' . $errorCode);
exit();
}