diff --git a/public/css/components/login.css b/public/css/components/login.css new file mode 100644 index 0000000..3802a53 --- /dev/null +++ b/public/css/components/login.css @@ -0,0 +1,54 @@ +.form-container { + background-color: #f2f2f2; + padding: 2rem; + border-radius: 8px; + width: 30%; + text-align: center; + margin: 0 auto; + margin-top: 15vh; + + form { + div { + .form-group { + display: flex; + flex-direction: column; + align-items: start !important; + } + + button[type="submit"] { + width: 100%; + } + } + } +} + +.form-container h1 { + margin-bottom: 1.5rem; +} + +.form-container .btn { + margin-top: 1rem; + width: 100%; + padding: 0.5rem; + border: none; + background-color: #007bff; + color: #ffffff; + border-radius: 4px; + cursor: pointer; + +} + +.form-container .btn:hover { + background-color: #0056b3; +} + +.form-container a { + display: block; + margin-top: 1rem; + color: #007bff; + text-decoration: none; +} + +.form-container a:hover { + text-decoration: underline; +} \ No newline at end of file diff --git a/src/Form/RegistrationFormType.php b/src/Form/RegistrationFormType.php index 9a657ba..781c954 100644 --- a/src/Form/RegistrationFormType.php +++ b/src/Form/RegistrationFormType.php @@ -6,28 +6,32 @@ use App\Entity\Profil; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\CheckboxType; use Symfony\Component\Form\Extension\Core\Type\PasswordType; +use Symfony\Component\Form\Extension\Core\Type\SubmitType; +use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; -use Symfony\Component\Validator\Constraints\IsTrue; -use Symfony\Component\Validator\Constraints\Length; -use Symfony\Component\Validator\Constraints\NotBlank; class RegistrationFormType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options): void { $builder - ->add('name') - ->add('agreeTerms', CheckboxType::class, [ - 'mapped' => false, - 'invalid_message' => 'You should agree to our terms.', + ->add('name', TextType::class, [ + 'label' => 'Username' ]) ->add('plainPassword', PasswordType::class, [ + 'label' => 'Password', 'mapped' => false, 'attr' => ['autocomplete' => 'new-password'], 'invalid_message' => 'Please enter a password', ]) - ; + ->add('agreeTerms', CheckboxType::class, [ + 'mapped' => false, + 'invalid_message' => 'You should agree to our terms.', + ]) + ->add('submit', SubmitType::class, [ + 'label' => 'Register' + ]); } public function configureOptions(OptionsResolver $resolver): void diff --git a/templates/registration/register.html.twig b/templates/registration/register.html.twig index 85f079f..990d4c9 100644 --- a/templates/registration/register.html.twig +++ b/templates/registration/register.html.twig @@ -3,68 +3,16 @@ {% block title %}Register{% endblock %} {% block stylesheets %} - + + {% endblock %} +{% form_theme registrationForm 'form/theme.html.twig' %} + {% block body %}

Register

- - {{ form_errors(registrationForm) }} - - {{ form_start(registrationForm) }} - {{ form_row(registrationForm.name) }} - {{ form_row(registrationForm.plainPassword, { - label: 'Password' - }) }} - {{ form_row(registrationForm.agreeTerms) }} - - - {{ form_end(registrationForm) }} - - or Login + {{ form(registrationForm) }} + or Log in
{% endblock %} diff --git a/templates/security/login.html.twig b/templates/security/login.html.twig index c2ba957..3424d8f 100644 --- a/templates/security/login.html.twig +++ b/templates/security/login.html.twig @@ -3,53 +3,13 @@ {% block title %}Log in!{% endblock %} {% block stylesheets %} - - + + {% endblock %} {% block body %}
+

Please Sign In

{% if error %}
{{ error.messageKey|trans(error.messageData, 'security') }}
@@ -60,27 +20,21 @@ 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 diff --git a/var/data.db b/var/data.db index 30fbbfc..a20c961 100644 Binary files a/var/data.db and b/var/data.db differ