Code Duplication    Length = 8-10 lines in 2 locations

settings/Controller/UsersController.php 2 locations

@@ 596-603 (lines=8) @@
593
		// address
594
		$oldDisplayName = $user->getDisplayName();
595
		$oldDisplayName = is_null($oldDisplayName) ? '' : $oldDisplayName;
596
		if (isset($data[AccountManager::PROPERTY_DISPLAYNAME]['value'])
597
			&& $oldDisplayName !== $data[AccountManager::PROPERTY_DISPLAYNAME]['value']
598
		) {
599
			$result = $user->setDisplayName($data[AccountManager::PROPERTY_DISPLAYNAME]['value']);
600
			if ($result === false) {
601
				throw new ForbiddenException($this->l10n->t('Unable to change full name'));
602
			}
603
		}
604
605
		$oldEmailAddress = $user->getEMailAddress();
606
		$oldEmailAddress = is_null($oldEmailAddress) ? '' : $oldEmailAddress;
@@ 607-616 (lines=10) @@
604
605
		$oldEmailAddress = $user->getEMailAddress();
606
		$oldEmailAddress = is_null($oldEmailAddress) ? '' : $oldEmailAddress;
607
		if (isset($data[AccountManager::PROPERTY_EMAIL]['value'])
608
			&& $oldEmailAddress !== $data[AccountManager::PROPERTY_EMAIL]['value']
609
		) {
610
			// this is the only permission a backend provides and is also used
611
			// for the permission of setting a email address
612
			if (!$user->canChangeDisplayName()) {
613
				throw new ForbiddenException($this->l10n->t('Unable to change email address'));
614
			}
615
			$user->setEMailAddress($data[AccountManager::PROPERTY_EMAIL]['value']);
616
		}
617
618
		$this->accountManager->updateUser($user, $data);
619
	}