Uniformize style a little bit

pull/10/head
Clément FRÉVILLE 11 months ago
parent 49d60871c9
commit 9c764d536e

@ -1,5 +1,6 @@
twig:
file_name_pattern: '*.twig'
form_themes: ['bootstrap_5_layout.html.twig']
when@test:
twig:

@ -1,27 +0,0 @@
<?php
namespace App\Controller;
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
class LoginController extends AbstractController
{
#[Route('/login', name: 'app_login')]
public function index(AuthenticationUtils $authenticationUtils): Response
{
// get the login error if there is one
$error = $authenticationUtils->getLastAuthenticationError();
// last username entered by the user
$lastUsername = $authenticationUtils->getLastUsername();
return $this->render('login/index.html.twig', [
'last_username' => $lastUsername,
'error' => $error,
]);
}
}

@ -3,8 +3,9 @@
<head>
<meta charset="UTF-8">
<title>{% block title %}Welcome to Herbarium!{% endblock %}</title>
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 128 128%22><text y=%221.2em%22 font-size=%2296%22>⚫️</text><text y=%221.3em%22 x=%220.2em%22 font-size=%2276%22 fill=%22%23fff%22>sf</text></svg>">
<meta name="viewport" content="width=device-width, initial-scale=1">
{% block stylesheets %}
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
{% endblock %}
{% block javascripts %}
@ -12,6 +13,18 @@
{% endblock %}
</head>
<body>
{% block body %}{% endblock %}
<nav class="navbar navbar-expand-lg bg-body-tertiary">
<div class="container-fluid">
<a class="navbar-brand" href="{{ path('app_species_index') }}">Herbarium</a>
{% if app.user %}
<a class="nav-link" href="{{ path('app_logout') }}">{{ app.user.email }} - Déconnexion</a>
{% else %}
<a class="nav-link" href="{{ path('app_login') }}">Connexion</a>
{% endif %}
</div>
</nav>
<div class="container my-4">
{% block body %}{% endblock %}
</div>
</body>
</html>

@ -1,22 +0,0 @@
{% extends 'base.html.twig' %}
{% block title %}Hello LoginController!{% endblock %}
{% block body %}
{% if error %}
<div>{{ error.messageKey|trans(error.messageData, 'security') }}</div>
{% endif %}
<form action="{{ path('app_login') }}" method="post">
<label for="username">Email:</label>
<input type="text" id="username" name="_username" value="{{ last_username }}">
<label for="password">Password:</label>
<input type="password" id="password" name="_password">
{# If you want to control the URL the user is redirected to on success
<input type="hidden" name="_target_path" value="/account"> #}
<button type="submit">login</button>
</form>
{% endblock %}

@ -1,4 +1,4 @@
<form method="post" action="{{ path('app_post_delete', {'id': post.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ post.id) }}">
<button class="btn">Delete</button>
<button class="btn btn-danger">Delete</button>
</form>

@ -14,6 +14,6 @@
}) }}
{{ form_row(registrationForm.agreeTerms) }}
<button type="submit" class="btn">Register</button>
<button type="submit" class="btn btn-primary">Register</button>
{{ form_end(registrationForm) }}
{% endblock %}

@ -15,10 +15,14 @@
{% endif %}
<h1 class="h3 mb-3 font-weight-normal">Please sign in</h1>
<label for="username">Email</label>
<input type="email" value="{{ last_username }}" name="_username" id="username" class="form-control" autocomplete="email" required autofocus>
<label for="password">Password</label>
<input type="password" name="_password" id="password" class="form-control" autocomplete="current-password" required>
<div class="mb-3">
<label for="username">Email</label>
<input type="email" value="{{ last_username }}" name="_username" id="username" class="form-control" autocomplete="email" required autofocus>
</div>
<div class="mb-3">
<label for="password">Password</label>
<input type="password" name="_password" id="password" class="form-control" autocomplete="current-password" required>
</div>
<input type="hidden" name="_csrf_token"
value="{{ csrf_token('authenticate') }}"
@ -35,8 +39,11 @@
</div>
#}
<button class="btn btn-lg btn-primary" type="submit">
<button class="btn btn-primary" type="submit">
Sign in
</button>
<a class="btn btn-secondary" href="{{ path('app_register') }}">
Sign up
</a>
</form>
{% endblock %}

@ -1,4 +1,4 @@
<form method="post" action="{{ path('app_species_delete', {'id': species.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ species.id) }}">
<button class="btn">Delete</button>
<button class="btn btn-danger">Delete</button>
</form>

Loading…
Cancel
Save