Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions builder/src/Forms/LoginForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);

Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion builder/tests/LoginFormTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function it_builds_a_login_form()

$expected = <<<HTML
<form action="/login" method="POST">
<input name="csrf_token" type="hidden" value="token_here">
<input name="csrf_token" type="hidden" id="csrf_token" class="form-control" required value="token_here">
<label for="email" class="sr-only">Email address</label>
<input name="email" type="email" id="email" class="form-control" required placeholder="Email address" autofocus>
<label for="password" class="sr-only">Password</label>
Expand Down