From 50f92d06beea88fe38fc1bb1ea7696e6c6b9f6b0 Mon Sep 17 00:00:00 2001 From: Corentin R Date: Fri, 14 Jun 2024 00:07:03 +0200 Subject: [PATCH] Styling login & register --- config/packages/framework.yaml | 1 + config/packages/twig.yaml | 1 + templates/base.html.twig | 16 ++- .../TwigBundle/Exception}/error.html.twig | 9 +- .../TwigBundle/Exception/error404.html.twig | 64 ++++++++++ templates/registration/register.html.twig | 69 ++++++++-- templates/security/login.html.twig | 118 ++++++++++++------ 7 files changed, 225 insertions(+), 53 deletions(-) rename templates/{ => bundles/TwigBundle/Exception}/error.html.twig (92%) create mode 100644 templates/bundles/TwigBundle/Exception/error404.html.twig diff --git a/config/packages/framework.yaml b/config/packages/framework.yaml index 877eb25..0ab00de 100644 --- a/config/packages/framework.yaml +++ b/config/packages/framework.yaml @@ -2,6 +2,7 @@ framework: secret: '%env(APP_SECRET)%' #csrf_protection: true + # error_controller: App\Controller\ErrorController::show # Note that the session will be started ONLY if you read or write from it. session: true diff --git a/config/packages/twig.yaml b/config/packages/twig.yaml index 90391cb..897e824 100644 --- a/config/packages/twig.yaml +++ b/config/packages/twig.yaml @@ -1,6 +1,7 @@ twig: file_name_pattern: '*.twig' form_themes: ['form_div_layout.html.twig'] + when@test: twig: diff --git a/templates/base.html.twig b/templates/base.html.twig index 8e1db6d..55e7281 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -8,12 +8,22 @@ {% block stylesheets %} + {% endblock %} {% block javascripts %} {% endblock %} - +
- {% block body %}{% endblock %} +
+ {% block body %}{% endblock %} +
diff --git a/templates/error.html.twig b/templates/bundles/TwigBundle/Exception/error.html.twig similarity index 92% rename from templates/error.html.twig rename to templates/bundles/TwigBundle/Exception/error.html.twig index 3cd56e1..ea42d04 100644 --- a/templates/error.html.twig +++ b/templates/bundles/TwigBundle/Exception/error.html.twig @@ -1,4 +1,9 @@ - +{% extends 'base.html.twig' %} + +{% block title %}Page non trouvée{% endblock %} + +{% block body %} + @@ -54,3 +59,5 @@ + +{% endblock %} \ No newline at end of file diff --git a/templates/bundles/TwigBundle/Exception/error404.html.twig b/templates/bundles/TwigBundle/Exception/error404.html.twig new file mode 100644 index 0000000..fb16639 --- /dev/null +++ b/templates/bundles/TwigBundle/Exception/error404.html.twig @@ -0,0 +1,64 @@ +{% extends 'base.html.twig' %} + +{% block title %}Page non trouvée{% endblock %} + +{% block body %} + + + + + + Error + + + +
+

Page Not Found

+

Error 404

+

We're sorry, but something went wrong. Please try again later.

+ {# Go to Homepage #} +
+ + + +{% endblock %} \ No newline at end of file diff --git a/templates/registration/register.html.twig b/templates/registration/register.html.twig index f192814..85f079f 100644 --- a/templates/registration/register.html.twig +++ b/templates/registration/register.html.twig @@ -3,21 +3,68 @@ {% block title %}Register{% endblock %} {% block stylesheets %} - + {% endblock %} {% block body %} -

Register

+
+

Register

+ + {{ form_errors(registrationForm) }} - {{ form_errors(registrationForm) }} + {{ form_start(registrationForm) }} + {{ form_row(registrationForm.name) }} + {{ form_row(registrationForm.plainPassword, { + label: 'Password' + }) }} + {{ form_row(registrationForm.agreeTerms) }} - {{ form_start(registrationForm) }} - {{ form_row(registrationForm.name) }} - {{ form_row(registrationForm.plainPassword, { - label: 'Password' - }) }} - {{ form_row(registrationForm.agreeTerms) }} + + {{ form_end(registrationForm) }} - - {{ form_end(registrationForm) }} + or Login +
{% endblock %} diff --git a/templates/security/login.html.twig b/templates/security/login.html.twig index 0924fe2..c2ba957 100644 --- a/templates/security/login.html.twig +++ b/templates/security/login.html.twig @@ -3,46 +3,86 @@ {% block title %}Log in!{% endblock %} {% block stylesheets %} - + + {% endblock %} {% block body %} -
- {% if error %} -
{{ error.messageKey|trans(error.messageData, 'security') }}
- {% endif %} - - {% if app.user %} -
- You are logged in as {{ app.user.userIdentifier }}, Logout -
- {% endif %} - -

Please sign in

- - - - - - - - {# - Uncomment this section and add a remember_me option below your firewall to activate remember me functionality. - See https://symfony.com/doc/current/security/remember_me.html - -
- -
- #} - - -
- - Or Register +
+
+ {% if error %} +
{{ error.messageKey|trans(error.messageData, 'security') }}
+ {% endif %} + + {% if app.user %} +
+ You are logged in as {{ app.user.userIdentifier }}, Logout +
+ {% endif %} + +

Please sign in

+ + + + + + + + {# + Uncomment this section and add a remember_me option below your firewall to activate remember me functionality. + See https://symfony.com/doc/current/security/remember_me.html + +
+ +
+ #} + + +
+ + Or Register +
{% endblock %} -- 2.36.3