From 732f37e02f18cfc2f0bb103a5d613ffabc93cfd4 Mon Sep 17 00:00:00 2001 From: Ryan Prather Date: Mon, 13 May 2024 21:08:35 -0400 Subject: [PATCH] Kernel and Form --- src/Form/RegistrationFormType.php | 48 +++++++++++++++++++++++++++++++ src/Kernel.php | 11 +++++++ 2 files changed, 59 insertions(+) create mode 100644 src/Form/RegistrationFormType.php create mode 100644 src/Kernel.php diff --git a/src/Form/RegistrationFormType.php b/src/Form/RegistrationFormType.php new file mode 100644 index 0000000..d7ad600 --- /dev/null +++ b/src/Form/RegistrationFormType.php @@ -0,0 +1,48 @@ +add('name', TextType::class) + ->add('email', EmailType::class) + ->add('plainPassword', PasswordType::class, [ + // instead of being set onto the object directly, + // this is read and encoded in the controller + 'mapped' => false, + 'attr' => ['autocomplete' => 'new-password'], + 'constraints' => [ + new NotBlank([ + 'message' => 'Please enter a password', + ]), + new Length([ + 'min' => 6, + 'minMessage' => 'Your password should be at least {{ limit }} characters', + // max length allowed by Symfony for security reasons + 'max' => 4096, + ]), + ], + ]) + ; + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => User::class, + ]); + } +} diff --git a/src/Kernel.php b/src/Kernel.php new file mode 100644 index 0000000..779cd1f --- /dev/null +++ b/src/Kernel.php @@ -0,0 +1,11 @@ +