Browse Source

Account : ajustement formulaires profil et changement de mot de passe

feature/symfony6.1
Guillaume 2 years ago
parent
commit
ec591db7a5
4 changed files with 28 additions and 5 deletions
  1. +2
    -0
      Form/User/ChangePasswordFormType.php
  2. +20
    -4
      Form/User/ProfileFormType.php
  3. +1
    -1
      Resources/translations/admin.fr.yaml
  4. +5
    -0
      Twig/TwigExtension.php

+ 2
- 0
Form/User/ChangePasswordFormType.php View File

@@ -54,6 +54,7 @@ class ChangePasswordFormType extends AbstractType
PasswordType::class,
[
'label' => 'form.account_password.field.current_password',
'translation_domain' => 'admin',
'mapped' => false,
'constraints' => [
new NotBlank(),
@@ -71,6 +72,7 @@ class ChangePasswordFormType extends AbstractType
'first_options' => ['label' => 'form.account_password.field.new_password'],
'second_options' => ['label' => 'form.account_password.field.new_password_repeat'],
'invalid_message' => $this->translatorAdmin->trans('form.account_password.message.invalid_passwords'),
'translation_domain' => 'admin',
]
);
}

+ 20
- 4
Form/User/ProfileFormType.php View File

@@ -32,23 +32,39 @@ class ProfileFormType extends AbstractType

$builder->add(
'firstname',
TextType::class
TextType::class,
[
'label' => 'entity.default.fields.firstname',
'translation_domain' => 'admin',
]
);

$builder->add(
'lastname',
TextType::class
TextType::class,
[
'label' => 'entity.default.fields.lastname',
'translation_domain' => 'admin',
]
);

$builder->add(
'email',
EmailType::class
EmailType::class,
[
'label' => 'entity.default.fields.email',
'translation_domain' => 'admin',
]
);

if (property_exists($entityName, 'phone')) {
$builder->add(
'phone',
TextType::class
TextType::class,
[
'label' => 'entity.default.fields.phone',
'translation_domain' => 'admin',
]
);
}
}

+ 1
- 1
Resources/translations/admin.fr.yaml View File

@@ -25,7 +25,7 @@ title:

action:
create: Créer
edit: Éditer
edit: Modifier
save: Sauvegarder
sort: Ordonner
delete: Supprimer

+ 5
- 0
Twig/TwigExtension.php View File

@@ -110,6 +110,7 @@ class TwigExtension extends AbstractExtension
new TwigFilter('format_price', [$this, 'formatPrice']),
new TwigFilter('sov_cache', [$this, 'sovCache']),
new TwigFilter('slugify', [$this, 'slugify']),
new TwigFilter('md5', [$this, 'md5']),
];
}

@@ -203,4 +204,8 @@ class TwigExtension extends AbstractExtension
return $adminUrlGenerator->generateUrl();
}

public function md5(string $text): string
{
return md5($text);
}
}

Loading…
Cancel
Save