Code Duplication    Length = 7-7 lines in 2 locations

settings/Controller/UsersController.php 1 location

@@ 755-761 (lines=7) @@
752
 	 */
753
	public function sendEmail($userId, $mailAddress) {
754
		$token = $this->config->getUserValue($userId, 'owncloud', 'changeMail');
755
		if ($token !== '') {
756
			$splittedToken = explode(':', $token);
757
			if ((count($splittedToken)) === 3 && $splittedToken[0] > ($this->timeFactory->getTime() - 60 * 5)) {
758
				$this->log->alert('The email is not sent because an email change confirmation mail was sent recently.');
759
				return false;
760
			}
761
		}
762
763
		$token = $this->secureRandom->generate(21,
764
			ISecureRandom::CHAR_DIGITS .

core/Controller/LostController.php 1 location

@@ 315-321 (lines=7) @@
312
		}
313
314
		$token = $this->config->getUserValue($user, 'owncloud', 'lostpassword');
315
		if ($token !== '') {
316
			$splittedToken = explode(':', $token);
317
			if ((count($splittedToken)) === 2 && $splittedToken[0] > ($this->timeFactory->getTime() - 60 * 5)) {
318
				$this->logger->alert('The email is not sent because a password reset email was sent recently.');
319
				return false;
320
			}
321
		}
322
323
		$token = $this->secureRandom->generate(21,
324
			ISecureRandom::CHAR_DIGITS .