src/Brick/User/UserManager.php
public function changeEmailStepOne(
		$userId,
		$email,
		Nette\Application\UI\ITemplate $template,
		Nette\Mail\Message $mailMessage,
		Nette\Mail\IMailer $mailer,
		$basePath = NULL
	) {
		$person = $this->get($userId);
		if (!isset($person->email) && $person->email == '') {
			return FALSE;
		}
		$tokenOne = Random::generate(4);
		$tokenTwo = Random::generate(4);

		$tokenHashOne = Passwords::hash($tokenOne);
		$tokenHashTwo = Passwords::hash($tokenTwo);

		$data = [
			'change_email' => $email,
			'change_email_token_one' => $tokenHashOne,
			'change_email_token_two' => $tokenHashTwo,
			'change_email_requested_at' => new DateTime(),
		];

		$this->repository->update($userId, $data);

		$statusOne = $this->changeEmailSendEmail($email, $tokenTwo, $template, $mailMessage, $mailer, $basePath);
		$statusTwo = $this->changeEmailSendEmail($person->email, $tokenOne, $template, $mailMessage, $mailer,
			$basePath);

		if ($statusOne && $statusTwo) {
			return TRUE;
		}

		return FALSE;
	}
public function changeEmailStepOne(
		$userId,
		$email,
		Nette\Application\UI\ITemplate $template,
		Nette\Mail\Message $mailMessage,
		Nette\Mail\IMailer $mailer,
		$basePath = NULL
	) {
		$person = $this->get($userId);
		if (!isset($person->email) && $person->email == '') {
			return FALSE;
		}
		$tokenOne = Random::generate(4);
		$tokenTwo = Random::generate(4);

		$tokenHashOne = Passwords::hash($tokenOne);
		$tokenHashTwo = Passwords::hash($tokenTwo);

		$data = [
			'change_email' => $email,
			'change_email_token_one' => $tokenHashOne,
			'change_email_token_two' => $tokenHashTwo,
			'change_email_requested_at' => new DateTime(),
		];

		$this->repository->update($userId, $data);

		$statusOne = $this->changeEmailSendEmail($email, $tokenTwo, $template, $mailMessage, $mailer, $basePath);
		$statusTwo = $this->changeEmailSendEmail($person->email, $tokenOne, $template, $mailMessage, $mailer,
			$basePath);

		if ($statusOne && $statusTwo) {
			return TRUE;
		}

		return FALSE;
	}
@param $userId
@param $email
@param Nette\Application\UI\ITemplate $template
@param Nette\Mail\Message $mailMessage
@param Nette\Mail\IMailer $mailer
@param null|string $basePath

@return bool