summaryrefslogtreecommitdiffstats
path: root/apps/encryption/controller/recoverycontroller.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/encryption/controller/recoverycontroller.php')
-rw-r--r--apps/encryption/controller/recoverycontroller.php42
1 files changed, 24 insertions, 18 deletions
diff --git a/apps/encryption/controller/recoverycontroller.php b/apps/encryption/controller/recoverycontroller.php
index bf548f24fc6..8ae37d97ecb 100644
--- a/apps/encryption/controller/recoverycontroller.php
+++ b/apps/encryption/controller/recoverycontroller.php
@@ -91,14 +91,14 @@ class RecoveryController extends Controller {
if (isset($adminEnableRecovery) && $adminEnableRecovery === '1') {
if ($this->recovery->enableAdminRecovery($recoveryPassword)) {
- return new DataResponse(['status' => 'success', 'data' => array('message' => (string)$this->l->t('Recovery key successfully enabled'))]);
+ return new DataResponse(['data' => ['message' => (string)$this->l->t('Recovery key successfully enabled')]]);
}
- return new DataResponse(['data' => array('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!')]], 500);
} elseif (isset($adminEnableRecovery) && $adminEnableRecovery === '0') {
if ($this->recovery->disableAdminRecovery($recoveryPassword)) {
- return new DataResponse(['data' => array('message' => (string)$this->l->t('Recovery key successfully disabled'))]);
+ return new DataResponse(['data' => ['message' => (string)$this->l->t('Recovery key successfully disabled')]]);
}
- return new DataResponse(['data' => array('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!')]], 500);
}
// this response should never be sent but just in case.
return new DataResponse(['data' => ['message' => (string)$this->l->t('Missing parameters')]], 500);
@@ -114,22 +114,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(array('data' => array('message' => $errorMessage)), 500);
+ return new DataResponse(['data' => ['message' => $errorMessage]], 500);
}
if (empty($newPassword)) {
$errorMessage = (string)$this->l->t('Please provide a new recovery password');
- return new DataResponse (array('data' => array('message' => $errorMessage)), 500);
+ return new DataResponse (['data' => ['message' => $errorMessage]], 500);
}
if (empty($confirmPassword)) {
$errorMessage = (string)$this->l->t('Please repeat the new recovery password');
- return new DataResponse(array('data' => array('message' => $errorMessage)), 500);
+ return new DataResponse(['data' => ['message' => $errorMessage]], 500);
}
if ($newPassword !== $confirmPassword) {
$errorMessage = (string)$this->l->t('Repeated recovery key password does not match the provided recovery key password');
- return new DataResponse(array('data' => array('message' => $errorMessage)), 500);
+ return new DataResponse(['data' => ['message' => $errorMessage]], 500);
}
$result = $this->recovery->changeRecoveryKeyPassword($newPassword,
@@ -137,19 +137,18 @@ class RecoveryController extends Controller {
if ($result) {
return new DataResponse(
- array(
- 'status' => 'success',
+ [
'data' => [
'message' => (string)$this->l->t('Password successfully changed.')]
- )
+ ]
);
}
return new DataResponse(
- array(
+ [
'data' => [
'message' => (string)$this->l->t('Could not change the password. Maybe the old password was not correct.')
]
- ), 500);
+ ], 500);
}
/**
@@ -164,22 +163,29 @@ class RecoveryController extends Controller {
$result = $this->recovery->setRecoveryForUser($userEnableRecovery);
if ($result) {
+ if ($userEnableRecovery === '0') {
+ return new DataResponse(
+ [
+ 'data' => [
+ 'message' => (string)$this->l->t('Recovery Key disabled')]
+ ]
+ );
+ }
return new DataResponse(
- array(
- 'status' => 'success',
+ [
'data' => [
'message' => (string)$this->l->t('Recovery Key enabled')]
- )
+ ]
);
}
}
return new DataResponse(
- array(
+ [
'data' => [
'message' => (string)$this->l->t('Could not enable the recovery key, please try again or contact your administrator')
]
- ), 500);
+ ], 500);
}
}