diff --git a/builder/src/Forms/LoginForm.php b/builder/src/Forms/LoginForm.php index 62a8350..4907334 100644 --- a/builder/src/Forms/LoginForm.php +++ b/builder/src/Forms/LoginForm.php @@ -23,7 +23,7 @@ public function __construct() public function build() { - $this->addCsrfInput(); + $this->addHiddenInput('csrf_token', 'token_here'); $this->addField('email', 'email', 'Email address', ['placeholder' => 'Email address', 'autofocus']); @@ -69,11 +69,9 @@ protected function addButton($type, $text) $this->form->add($button); } - protected function addCsrfInput() + protected function addHiddenInput($name, $value) { - $csrfInput = new Input('csrf_token', ['type' => 'hidden', 'name' => 'csrf_token', 'value' => 'token_here']); - - $this->form->add($csrfInput); + $this->addInput('hidden', $name, ['value' => $value]); } protected function addLabel($id, $text) diff --git a/builder/tests/LoginFormTest.php b/builder/tests/LoginFormTest.php index e865f6c..46df213 100644 --- a/builder/tests/LoginFormTest.php +++ b/builder/tests/LoginFormTest.php @@ -15,7 +15,7 @@ function it_builds_a_login_form() $expected = << - +