formregister

This commit is contained in:
barillote 2024-11-21 17:16:41 +01:00
parent 39a8e59288
commit e729450c64
4 changed files with 70 additions and 12 deletions

View File

@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20241121153037 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
}
}

View File

@ -26,8 +26,8 @@ class Announcement
#[ORM\JoinColumn(nullable: false)]
private ?Company $company = null;
#[ORM\Column(length: 255)]
private ?string $status = 'notVerified';
#[ORM\Column(nullable: false)]
private ?string $status = null;
/**
* @var ?Collection<int, InternApplication>

View File

@ -3,11 +3,12 @@
namespace App\Form;
use App\Entity\UserApp;
use Doctrine\DBAL\Types\StringType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints\IsTrue;
@ -19,15 +20,38 @@ class RegistrationFormType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('nickname')
->add('agreeTerms', CheckboxType::class, [
'mapped' => false,
'constraints' => [
new IsTrue([
'message' => 'Vous devez accepter les conditions d\'utilisation.',
]),
],
->add('nickname', TextType::class, [
'label' => 'Utilisateur : ',
])
->add('firstname', TextType::class, [
'label' => 'Prénom : ',
'required' => true,
'constraints' => [
new NotBlank(),
]
])
->add('lastname', TextType::class, [
'label' => 'Nom : ',
'required' => true,
'constraints' => [
new NotBlank(),
]
])
->add('mail', EmailType::class, [
'label' => 'Email : ',
'required' => true,
'constraints' => [
new NotBlank(),
]
])
// ->add('agreeTerms', CheckboxType::class, [
// 'mapped' => false,
// 'constraints' => [
// new IsTrue([
// 'message' => 'Vous devez accepter les conditions d\'utilisation.',
// ]),
// ],
// ])
->add('plainPassword', PasswordType::class, [
// instead of being set onto the object directly,
// this is read and encoded in the controller

View File

@ -9,10 +9,13 @@
{{ form_start(registrationForm) }}
{{ form_row(registrationForm.nickname) }}
{{ form_row(registrationForm.firstname) }}
{{ form_row(registrationForm.lastname) }}
{{ form_row(registrationForm.mail) }}
{{ form_row(registrationForm.plainPassword, {
label: 'Password'
}) }}
{{ form_row(registrationForm.agreeTerms) }}
{# {{ form_row(registrationForm.agreeTerms) }}#}
<button type="submit" class="btn">S'inscrire</button>
{{ form_end(registrationForm) }}