Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- declare(strict_types=1);
- namespace App\Forms;
- use App\Model\UserAuthenticator;
- use Nette;
- use Nette\Application\UI\Form;
- use Nette\Security\User;
- use stdClass;
- final class SignInFormFactory {
- use Nette\SmartObject;
- private FormFactory $factory;
- private User $user;
- public function __construct(FormFactory $factory, User $user) {
- $this->factory = $factory;
- $this->user = $user;
- }
- public function create(callable $onSuccess): Form {
- $form = $this->factory->create();
- $form->addText('name', 'Jméno')->setRequired();
- $form->addPassword('password', 'Heslo')->setRequired();
- $form->addSubmit('send', 'Přihlásit se');
- $form->onSuccess[] = function (stdClass $values) use ($onSuccess): void {
- $onSuccess;
- };
- return $form;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment