| @@ 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'); |
|
| @@ 210-219 (lines=10) @@ | ||
| 207 | } |
|
| 208 | $newLogo = $this->request->getUploadedFile('uploadlogo'); |
|
| 209 | $newBackgroundLogo = $this->request->getUploadedFile('upload-login-background'); |
|
| 210 | if (empty($newLogo) && empty($newBackgroundLogo)) { |
|
| 211 | return new DataResponse( |
|
| 212 | [ |
|
| 213 | 'data' => [ |
|
| 214 | 'message' => $this->l10n->t('No file uploaded') |
|
| 215 | ] |
|
| 216 | ], |
|
| 217 | Http::STATUS_UNPROCESSABLE_ENTITY |
|
| 218 | ); |
|
| 219 | } |
|
| 220 | ||
| 221 | $name = ''; |
|
| 222 | try { |
|