| @@ 76-80 (lines=5) @@ | ||
| 73 | */ |
|
| 74 | public function adminRecovery($recoveryPassword, $confirmPassword, $adminEnableRecovery) { |
|
| 75 | // Check if both passwords are the same |
|
| 76 | if (empty($recoveryPassword)) { |
|
| 77 | $errorMessage = (string)$this->l->t('Missing recovery key password'); |
|
| 78 | return new DataResponse(['data' => ['message' => $errorMessage]], |
|
| 79 | Http::STATUS_BAD_REQUEST); |
|
| 80 | } |
|
| 81 | ||
| 82 | if (empty($confirmPassword)) { |
|
| 83 | $errorMessage = (string)$this->l->t('Please repeat the recovery key password'); |
|
| @@ 82-86 (lines=5) @@ | ||
| 79 | Http::STATUS_BAD_REQUEST); |
|
| 80 | } |
|
| 81 | ||
| 82 | if (empty($confirmPassword)) { |
|
| 83 | $errorMessage = (string)$this->l->t('Please repeat the recovery key password'); |
|
| 84 | return new DataResponse(['data' => ['message' => $errorMessage]], |
|
| 85 | Http::STATUS_BAD_REQUEST); |
|
| 86 | } |
|
| 87 | ||
| 88 | if ($recoveryPassword !== $confirmPassword) { |
|
| 89 | $errorMessage = (string)$this->l->t('Repeated recovery key password does not match the provided recovery key password'); |
|
| @@ 117-120 (lines=4) @@ | ||
| 114 | */ |
|
| 115 | public function changeRecoveryPassword($newPassword, $oldPassword, $confirmPassword) { |
|
| 116 | //check if both passwords are the same |
|
| 117 | if (empty($oldPassword)) { |
|
| 118 | $errorMessage = (string)$this->l->t('Please provide the old recovery password'); |
|
| 119 | return new DataResponse(['data' => ['message' => $errorMessage]], Http::STATUS_BAD_REQUEST); |
|
| 120 | } |
|
| 121 | ||
| 122 | if (empty($newPassword)) { |
|
| 123 | $errorMessage = (string)$this->l->t('Please provide a new recovery password'); |
|
| @@ 122-125 (lines=4) @@ | ||
| 119 | return new DataResponse(['data' => ['message' => $errorMessage]], Http::STATUS_BAD_REQUEST); |
|
| 120 | } |
|
| 121 | ||
| 122 | if (empty($newPassword)) { |
|
| 123 | $errorMessage = (string)$this->l->t('Please provide a new recovery password'); |
|
| 124 | return new DataResponse (['data' => ['message' => $errorMessage]], Http::STATUS_BAD_REQUEST); |
|
| 125 | } |
|
| 126 | ||
| 127 | if (empty($confirmPassword)) { |
|
| 128 | $errorMessage = (string)$this->l->t('Please repeat the new recovery password'); |
|
| @@ 127-130 (lines=4) @@ | ||
| 124 | return new DataResponse (['data' => ['message' => $errorMessage]], Http::STATUS_BAD_REQUEST); |
|
| 125 | } |
|
| 126 | ||
| 127 | if (empty($confirmPassword)) { |
|
| 128 | $errorMessage = (string)$this->l->t('Please repeat the new recovery password'); |
|
| 129 | return new DataResponse(['data' => ['message' => $errorMessage]], Http::STATUS_BAD_REQUEST); |
|
| 130 | } |
|
| 131 | ||
| 132 | if ($newPassword !== $confirmPassword) { |
|
| 133 | $errorMessage = (string)$this->l->t('Repeated recovery key password does not match the provided recovery key password'); |
|
| @@ 189-198 (lines=10) @@ | ||
| 186 | public function updateLogo() { |
|
| 187 | $newLogo = $this->request->getUploadedFile('uploadlogo'); |
|
| 188 | $newBackgroundLogo = $this->request->getUploadedFile('upload-login-background'); |
|
| 189 | if (empty($newLogo) && empty($newBackgroundLogo)) { |
|
| 190 | return new DataResponse( |
|
| 191 | [ |
|
| 192 | 'data' => [ |
|
| 193 | 'message' => $this->l10n->t('No file uploaded') |
|
| 194 | ] |
|
| 195 | ], |
|
| 196 | Http::STATUS_UNPROCESSABLE_ENTITY |
|
| 197 | ); |
|
| 198 | } |
|
| 199 | ||
| 200 | $name = ''; |
|
| 201 | try { |
|