Code Duplication    Length = 8-10 lines in 2 locations

settings/Controller/UsersController.php 2 locations

@@ 808-815 (lines=8) @@
805
		// address
806
		$oldDisplayName = $user->getDisplayName();
807
		$oldDisplayName = is_null($oldDisplayName) ? '' : $oldDisplayName;
808
		if (isset($data[AccountManager::PROPERTY_DISPLAYNAME]['value'])
809
			&& $oldDisplayName !== $data[AccountManager::PROPERTY_DISPLAYNAME]['value']
810
		) {
811
			$result = $user->setDisplayName($data[AccountManager::PROPERTY_DISPLAYNAME]['value']);
812
			if ($result === false) {
813
				throw new ForbiddenException($this->l10n->t('Unable to change full name'));
814
			}
815
		}
816
817
		$oldEmailAddress = $user->getEMailAddress();
818
		$oldEmailAddress = is_null($oldEmailAddress) ? '' : $oldEmailAddress;
@@ 819-828 (lines=10) @@
816
817
		$oldEmailAddress = $user->getEMailAddress();
818
		$oldEmailAddress = is_null($oldEmailAddress) ? '' : $oldEmailAddress;
819
		if (isset($data[AccountManager::PROPERTY_EMAIL]['value'])
820
			&& $oldEmailAddress !== $data[AccountManager::PROPERTY_EMAIL]['value']
821
		) {
822
			// this is the only permission a backend provides and is also used
823
			// for the permission of setting a email address
824
			if (!$user->canChangeDisplayName()) {
825
				throw new ForbiddenException($this->l10n->t('Unable to change email address'));
826
			}
827
			$user->setEMailAddress($data[AccountManager::PROPERTY_EMAIL]['value']);
828
		}
829
830
		$this->accountManager->updateUser($user, $data);
831
	}