Add the login page, add some comments to the test.
This commit is contained in:
parent
34e45ecaee
commit
4ff2c8cc3a
@ -124,7 +124,6 @@ class Bootstrap
|
|||||||
* @var Configuration
|
* @var Configuration
|
||||||
*/
|
*/
|
||||||
$config = $container->get('config');
|
$config = $container->get('config');
|
||||||
$app->addErrorMiddleware(true, true, true);
|
|
||||||
|
|
||||||
// Twig
|
// Twig
|
||||||
$templatePath = __DIR__ . "/../templates";
|
$templatePath = __DIR__ . "/../templates";
|
||||||
@ -140,6 +139,9 @@ class Bootstrap
|
|||||||
$twig->getEnvironment()
|
$twig->getEnvironment()
|
||||||
->addGlobal('flash', $flash);
|
->addGlobal('flash', $flash);
|
||||||
$app->add(TwigMiddleware::create($app, $twig));
|
$app->add(TwigMiddleware::create($app, $twig));
|
||||||
|
|
||||||
|
// Add the error handling middleware
|
||||||
|
$app->addErrorMiddleware(true, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
14
app/src/Controller/User/LoginUserPage.php
Normal file
14
app/src/Controller/User/LoginUserPage.php
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Slovocast\Controller\User;
|
||||||
|
|
||||||
|
use Psr\Http\Message\ResponseInterface as Response;
|
||||||
|
use Slovocast\Controller\Controller;
|
||||||
|
|
||||||
|
class LoginUserPage extends Controller
|
||||||
|
{
|
||||||
|
public function respond(): Response
|
||||||
|
{
|
||||||
|
return $this->render('user/login');
|
||||||
|
}
|
||||||
|
}
|
19
app/templates/user/login.twig
Normal file
19
app/templates/user/login.twig
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{% extends 'layouts/skeleton.twig' %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div>
|
||||||
|
<form action="/login" method="post">
|
||||||
|
<div>
|
||||||
|
<label for="email">Email<br>
|
||||||
|
<input name="email" type="text" required>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label for="password">Password<br>
|
||||||
|
<input name="password" type="password" required>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<input type="submit" label="Submit">
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
@ -93,8 +93,10 @@ class RegisterUserActionTest extends TestCase
|
|||||||
$this->assertEquals(400, $response->getStatusCode());
|
$this->assertEquals(400, $response->getStatusCode());
|
||||||
|
|
||||||
$responseBody = $response->getBody();
|
$responseBody = $response->getBody();
|
||||||
|
// get the class of the flash on the rendered page
|
||||||
$this->assertTrue((bool)preg_match('/flash error/', $responseBody));
|
$this->assertTrue((bool)preg_match('/flash error/', $responseBody));
|
||||||
$this->assertTrue((bool)preg_match('/Unable to register user/', $responseBody));
|
// get the text inside the flash
|
||||||
|
$this->assertTrue((bool)preg_match('/Unable to register user\./', $responseBody));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Flash messages are already exhausted while rendering the
|
* The Flash messages are already exhausted while rendering the
|
||||||
|
Loading…
Reference in New Issue
Block a user