Code Duplication    Length = 8-10 lines in 2 locations

settings/Controller/ChangePasswordController.php 2 locations

@@ 99-108 (lines=10) @@
96
	public function changePersonalPassword($oldpassword = '', $newpassword = null) {
97
		/** @var IUser $user */
98
		$user = $this->userManager->checkPassword($this->userId, $oldpassword);
99
		if ($user === false) {
100
			$response = new JSONResponse([
101
				'status' => 'error',
102
				'data' => [
103
					'message' => $this->l->t('Wrong password'),
104
				],
105
			]);
106
			$response->throttle();
107
			return $response;
108
		}
109
110
		try {
111
			if ($newpassword === null || $user->setPassword($newpassword) === false) {
@@ 264-271 (lines=8) @@
261
			}
262
		} else {
263
			try {
264
				if ($targetUser->setPassword($password) === false) {
265
					return new JSONResponse([
266
						'status' => 'error',
267
						'data' => [
268
							'message' => $this->l->t('Unable to change password'),
269
						],
270
					]);
271
				}
272
			// password policy app throws exception
273
			} catch(HintException $e) {
274
				return new JSONResponse([