From 4ea88682c7764863e0ede00f78aac69a64b1da02 Mon Sep 17 00:00:00 2001 From: Abel Ponce Date: Mon, 26 Mar 2018 22:44:17 -0600 Subject: [PATCH] Add hidden input --- builder/src/Forms/LoginForm.php | 8 +++----- builder/tests/LoginFormTest.php | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) 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 = << - +