/** * @param \Nette\Application\UI\Form $form */ private function formSucceeded(Form $form) { $values = $form->getValues(); $row = $this->userProvider->email($this->email)->limit(1)->fetch(); if ($row === FALSE) { $this->onRecordNotFound($this->translator->translate('Email uživatele není platný.')); } $this->userProvider->changePassword($row->id, $values->password); $this->tokenProvider->deleteToken($this->token); $this->onPasswordChanged($this->translator->translate('Heslo bylo změněno')); }
/** * @param \Nette\Application\UI\Form $form */ private function formSucceeded(Form $form) { $values = $form->getValues(); $record = $this->userProvider->username($values->username)->fetch(); if (!$record) { $this->onRecordNotFound($this->translator->translate("Uživatel '{$values->username}' v systému neexistuje")); } $data = new \StdClass(); $data->from = $this->from; $data->to = $record->email; $data->subject = $this->translator->translate('Zapomenuté heslo do adminu'); $tokenData = $this->getTokenData($record->email); $data->token = $tokenData->token; $data->valid_to = $tokenData->valid_to; $this->mailFactory->sendLostPasswordEmail($data); $this->onEmailSend($this->translator->translate("Na Váš email byl zaslán link pro obnovu hesla")); }