[Pkg-owncloud-commits] [owncloud] 09/122: fix messages from settings crontroller

David Prévot taffit at moszumanska.debian.org
Sat May 9 00:00:01 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch stable8
in repository owncloud.

commit 29168665cb8acb3296ba734500a869a70313abdc
Author: Clark Tomlinson <fallen013 at gmail.com>
Date:   Wed Apr 22 13:26:06 2015 -0400

    fix messages from settings crontroller
---
 apps/encryption/controller/recoverycontroller.php | 25 ++++++++++++-----------
 apps/encryption/js/settings-personal.js           |  4 ++--
 2 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/apps/encryption/controller/recoverycontroller.php b/apps/encryption/controller/recoverycontroller.php
index 8ae37d9..f163b8f 100644
--- a/apps/encryption/controller/recoverycontroller.php
+++ b/apps/encryption/controller/recoverycontroller.php
@@ -26,6 +26,7 @@ namespace OCA\Encryption\Controller;
 
 use OCA\Encryption\Recovery;
 use OCP\AppFramework\Controller;
+use OCP\AppFramework\Http;
 use OCP\IConfig;
 use OCP\IL10N;
 use OCP\IRequest;
@@ -74,34 +75,34 @@ class RecoveryController extends Controller {
 		if (empty($recoveryPassword)) {
 			$errorMessage = (string)$this->l->t('Missing recovery key password');
 			return new DataResponse(['data' => ['message' => $errorMessage]],
-				500);
+				Http::STATUS_INTERNAL_SERVER_ERROR);
 		}
 
 		if (empty($confirmPassword)) {
 			$errorMessage = (string)$this->l->t('Please repeat the recovery key password');
 			return new DataResponse(['data' => ['message' => $errorMessage]],
-				500);
+				Http::STATUS_INTERNAL_SERVER_ERROR);
 		}
 
 		if ($recoveryPassword !== $confirmPassword) {
 			$errorMessage = (string)$this->l->t('Repeated recovery key password does not match the provided recovery key password');
 			return new DataResponse(['data' => ['message' => $errorMessage]],
-				500);
+				Http::STATUS_INTERNAL_SERVER_ERROR);
 		}
 
 		if (isset($adminEnableRecovery) && $adminEnableRecovery === '1') {
 			if ($this->recovery->enableAdminRecovery($recoveryPassword)) {
 				return new DataResponse(['data' => ['message' => (string)$this->l->t('Recovery key successfully enabled')]]);
 			}
-			return new DataResponse(['data' => ['message' => (string)$this->l->t('Could not enable recovery key. Please check your recovery key password!')]], 500);
+			return new DataResponse(['data' => ['message' => (string)$this->l->t('Could not enable recovery key. Please check your recovery key password!')]], Http::STATUS_INTERNAL_SERVER_ERROR);
 		} elseif (isset($adminEnableRecovery) && $adminEnableRecovery === '0') {
 			if ($this->recovery->disableAdminRecovery($recoveryPassword)) {
 				return new DataResponse(['data' => ['message' => (string)$this->l->t('Recovery key successfully disabled')]]);
 			}
-			return new DataResponse(['data' => ['message' => (string)$this->l->t('Could not disable recovery key. Please check your recovery key password!')]], 500);
+			return new DataResponse(['data' => ['message' => (string)$this->l->t('Could not disable recovery key. Please check your recovery key password!')]], Http::STATUS_INTERNAL_SERVER_ERROR);
 		}
 		// this response should never be sent but just in case.
-		return new DataResponse(['data' => ['message' => (string)$this->l->t('Missing parameters')]], 500);
+		return new DataResponse(['data' => ['message' => (string)$this->l->t('Missing parameters')]], Http::STATUS_INTERNAL_SERVER_ERROR);
 	}
 
 	/**
@@ -114,22 +115,22 @@ class RecoveryController extends Controller {
 		//check if both passwords are the same
 		if (empty($oldPassword)) {
 			$errorMessage = (string)$this->l->t('Please provide the old recovery password');
-			return new DataResponse(['data' => ['message' => $errorMessage]], 500);
+			return new DataResponse(['data' => ['message' => $errorMessage]], Http::STATUS_INTERNAL_SERVER_ERROR);
 		}
 
 		if (empty($newPassword)) {
 			$errorMessage = (string)$this->l->t('Please provide a new recovery password');
-			return new DataResponse (['data' => ['message' => $errorMessage]], 500);
+			return new DataResponse (['data' => ['message' => $errorMessage]], Http::STATUS_INTERNAL_SERVER_ERROR);
 		}
 
 		if (empty($confirmPassword)) {
 			$errorMessage = (string)$this->l->t('Please repeat the new recovery password');
-			return new DataResponse(['data' => ['message' => $errorMessage]], 500);
+			return new DataResponse(['data' => ['message' => $errorMessage]], Http::STATUS_INTERNAL_SERVER_ERROR);
 		}
 
 		if ($newPassword !== $confirmPassword) {
 			$errorMessage = (string)$this->l->t('Repeated recovery key password does not match the provided recovery key password');
-			return new DataResponse(['data' => ['message' => $errorMessage]], 500);
+			return new DataResponse(['data' => ['message' => $errorMessage]], Http::STATUS_INTERNAL_SERVER_ERROR);
 		}
 
 		$result = $this->recovery->changeRecoveryKeyPassword($newPassword,
@@ -148,7 +149,7 @@ class RecoveryController extends Controller {
 				'data' => [
 					'message' => (string)$this->l->t('Could not change the password. Maybe the old password was not correct.')
 				]
-			], 500);
+			], Http::STATUS_INTERNAL_SERVER_ERROR);
 	}
 
 	/**
@@ -185,7 +186,7 @@ class RecoveryController extends Controller {
 				'data' => [
 					'message' => (string)$this->l->t('Could not enable the recovery key, please try again or contact your administrator')
 				]
-			], 500);
+			], Http::STATUS_INTERNAL_SERVER_ERROR);
 	}
 
 }
diff --git a/apps/encryption/js/settings-personal.js b/apps/encryption/js/settings-personal.js
index 4728da8..658ba2a 100644
--- a/apps/encryption/js/settings-personal.js
+++ b/apps/encryption/js/settings-personal.js
@@ -20,10 +20,10 @@ OC.Encryption = {
 				newPassword: newPrivateKeyPassword
 			}
 		).done(function (data) {
-				OC.msg.finishedSuccess('#encryption .msg', data.data.message);
+				OC.msg.finishedSuccess('#encryption .msg', data.message);
 			})
 			.fail(function (jqXHR) {
-				OC.msg.finishedError('#encryption .msg', JSON.parse(jqXHR.responseText).data.message);
+				OC.msg.finishedError('#encryption .msg', JSON.parse(jqXHR.responseText).message);
 			});
 	}
 };

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list