Code Duplication    Length = 8-10 lines in 2 locations

settings/Controller/UsersController.php 2 locations

@@ 779-786 (lines=8) @@
776
		// address
777
		$oldDisplayName = $user->getDisplayName();
778
		$oldDisplayName = is_null($oldDisplayName) ? '' : $oldDisplayName;
779
		if (isset($data[AccountManager::PROPERTY_DISPLAYNAME]['value'])
780
			&& $oldDisplayName !== $data[AccountManager::PROPERTY_DISPLAYNAME]['value']
781
		) {
782
			$result = $user->setDisplayName($data[AccountManager::PROPERTY_DISPLAYNAME]['value']);
783
			if ($result === false) {
784
				throw new ForbiddenException($this->l10n->t('Unable to change full name'));
785
			}
786
		}
787
788
		$oldEmailAddress = $user->getEMailAddress();
789
		$oldEmailAddress = is_null($oldEmailAddress) ? '' : $oldEmailAddress;
@@ 790-799 (lines=10) @@
787
788
		$oldEmailAddress = $user->getEMailAddress();
789
		$oldEmailAddress = is_null($oldEmailAddress) ? '' : $oldEmailAddress;
790
		if (isset($data[AccountManager::PROPERTY_EMAIL]['value'])
791
			&& $oldEmailAddress !== $data[AccountManager::PROPERTY_EMAIL]['value']
792
		) {
793
			// this is the only permission a backend provides and is also used
794
			// for the permission of setting a email address
795
			if (!$user->canChangeDisplayName()) {
796
				throw new ForbiddenException($this->l10n->t('Unable to change email address'));
797
			}
798
			$user->setEMailAddress($data[AccountManager::PROPERTY_EMAIL]['value']);
799
		}
800
801
		$this->accountManager->updateUser($user, $data);
802
	}