redirection good
This commit is contained in:
@@ -39,4 +39,22 @@ footer {
|
||||
|
||||
.star.text-yellow-500 {
|
||||
color: gold;
|
||||
}
|
||||
|
||||
.bgRegisterText {
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.bgRegister {
|
||||
background-color: #A3D9B1;
|
||||
}
|
||||
|
||||
.btnRegister {
|
||||
background-color: #FF6F61;
|
||||
border-color: #C8504C;
|
||||
}
|
||||
|
||||
.btnRegister:hover {
|
||||
background-color: rgb(218, 76, 93);
|
||||
border-color: #FF6F61;
|
||||
}
|
||||
@@ -22,12 +22,10 @@ security:
|
||||
login_path: app_login
|
||||
check_path: app_login
|
||||
enable_csrf: true
|
||||
default_target_path: home
|
||||
always_use_default_target_path: true
|
||||
logout:
|
||||
path: app_logout
|
||||
target: app_login
|
||||
# where to redirect after logout
|
||||
# target: app_any_route
|
||||
|
||||
# activate different ways to authenticate
|
||||
# https://symfony.com/doc/current/security.html#the-firewall
|
||||
@@ -38,8 +36,9 @@ security:
|
||||
# Easy way to control access for large sections of your site
|
||||
# Note: Only the *first* access control that matches will be used
|
||||
access_control:
|
||||
# - { path: ^/admin, roles: ROLE_ADMIN }
|
||||
# - { path: ^/profile, roles: ROLE_USER }
|
||||
- { path: ^/login, roles: PUBLIC_ACCESS }
|
||||
- { path: ^/register, roles: PUBLIC_ACCESS }
|
||||
- { path: ^/, roles: ROLE_USER }
|
||||
|
||||
when@test:
|
||||
security:
|
||||
|
||||
@@ -16,6 +16,10 @@ class LoginController extends AbstractController
|
||||
#[Route(path: '/login', name: 'app_login')]
|
||||
public function login(AuthenticationUtils $authenticationUtils, Security $security, Request $request): Response
|
||||
{
|
||||
if ($security->isGranted('ROLE_USER')) {
|
||||
return $this->redirectToRoute('home'); // Redirection pour utilisateurs connectés
|
||||
}
|
||||
|
||||
// get the login error if there is one
|
||||
$error = $authenticationUtils->getLastAuthenticationError();
|
||||
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
value="{{ csrf_token('authenticate') }}"
|
||||
>
|
||||
<div class="flex flex-row justify-between">
|
||||
<button class="bg-blue-500 hover:bg-blue-400 text-white font-bold py-2 px-4 border-b-4 border-blue-700 hover:border-blue-500 rounded" type="submit">Se connecter</button>
|
||||
<button class=" text-white font-bold py-2 px-4 border-b-4 btnRegister rounded" type="submit">Se connecter</button>
|
||||
<a href="{{ path('app_register') }}">
|
||||
<button class="bg-blue-500 hover:bg-blue-400 text-white font-bold py-2 px-4 border-b-4 border-blue-700 hover:border-blue-500 rounded mx-auto" type="button">S'inscrire</button>
|
||||
<button class=" text-white font-bold py-2 px-4 border-b-4 btnRegister rounded mx-auto" type="button">S'inscrire</button>
|
||||
</a>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
|
||||
{% block content %}
|
||||
<div class="flex flex-row justify-center items-stretch py-24">
|
||||
<div class="bg-gray-500 shadow-lg p-8 max-w-sm text-center flex-1">
|
||||
<h2 class="text-white text-2xl font-semibold py-6">Sortir !</h2>
|
||||
<p class="text-lg text-gray-300 mt-3 leading-relaxed">Bienvenue sur notre application web référencant tout type d'évènements à travers le monde. N'hésitez pas à vous inscrire sur notre plateforme et y invitez vos amis afins de participer à des évènements simplement et qui vous conviennent !</p>
|
||||
<div class="bgRegister shadow-lg p-8 max-w-sm text-center flex-1">
|
||||
<h2 class="bgRegisterText text-2xl font-semibold py-6">Sortir !</h2>
|
||||
<p class="text-lg bgRegisterText mt-3 leading-relaxed">Bienvenue sur notre application web référencant tout type d'évènements à travers le monde. N'hésitez pas à vous inscrire sur notre plateforme et y invitez vos amis afins de participer à des évènements simplement et qui vous conviennent !</p>
|
||||
</div>
|
||||
<div class="bg-white shadow-lg p-8 max-w-sm text-center flex-1">
|
||||
<h2 class="text-2xl font-bold text-center pb-6">S'inscrire</h2>
|
||||
@@ -23,7 +23,7 @@
|
||||
{{ form_row(registrationForm.telephone) }}
|
||||
{{ form_row(registrationForm.email) }}
|
||||
{{ form_row(registrationForm.plainPassword) }}
|
||||
<button class="bg-blue-500 hover:bg-blue-400 text-white font-bold py-2 px-4 border-b-4 border-blue-700 hover:border-blue-500 rounded mx-auto" type="submit">S'inscrire</button>
|
||||
<button class="btnRegister text-white font-bold py-2 px-4 border-b-4 rounded mx-auto" type="submit">S'inscrire</button>
|
||||
{{ form_end(registrationForm) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user