Code Duplication    Length = 8-10 lines in 2 locations

settings/Controller/UsersController.php 2 locations

@@ 708-715 (lines=8) @@
705
		// address
706
		$oldDisplayName = $user->getDisplayName();
707
		$oldDisplayName = is_null($oldDisplayName) ? '' : $oldDisplayName;
708
		if (isset($data[AccountManager::PROPERTY_DISPLAYNAME]['value'])
709
			&& $oldDisplayName !== $data[AccountManager::PROPERTY_DISPLAYNAME]['value']
710
		) {
711
			$result = $user->setDisplayName($data[AccountManager::PROPERTY_DISPLAYNAME]['value']);
712
			if ($result === false) {
713
				throw new ForbiddenException($this->l10n->t('Unable to change full name'));
714
			}
715
		}
716
717
		$oldEmailAddress = $user->getEMailAddress();
718
		$oldEmailAddress = is_null($oldEmailAddress) ? '' : $oldEmailAddress;
@@ 719-728 (lines=10) @@
716
717
		$oldEmailAddress = $user->getEMailAddress();
718
		$oldEmailAddress = is_null($oldEmailAddress) ? '' : $oldEmailAddress;
719
		if (isset($data[AccountManager::PROPERTY_EMAIL]['value'])
720
			&& $oldEmailAddress !== $data[AccountManager::PROPERTY_EMAIL]['value']
721
		) {
722
			// this is the only permission a backend provides and is also used
723
			// for the permission of setting a email address
724
			if (!$user->canChangeDisplayName()) {
725
				throw new ForbiddenException($this->l10n->t('Unable to change email address'));
726
			}
727
			$user->setEMailAddress($data[AccountManager::PROPERTY_EMAIL]['value']);
728
		}
729
730
		$this->accountManager->updateUser($user, $data);
731
	}