Browse Source

Merge branch 'develop' of https://gitea.laclic.fr/Laclic/SovBundle into develop

tags/0.1
Fab 3 years ago
parent
commit
8c68c0df0f
4 changed files with 22 additions and 10 deletions
  1. +5
    -0
      Controller/Admin/UserController.php
  2. +5
    -5
      Form/Type/User/ChangePasswordFormType.php
  3. +11
    -4
      Resources/translations/admin.fr.yaml
  4. +1
    -1
      Translation/TranslatorAdmin.php

+ 5
- 0
Controller/Admin/UserController.php View File

use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
use Symfony\Component\Translation\TranslatableMessage;


class UserController extends AbstractController class UserController extends AbstractController
{ {


$this->em->update($user); $this->em->update($user);
$this->em->flush(); $this->em->flush();

$this->addFlash('success', new TranslatableMessage('form.account_profile.message.success', [], 'admin'));
} }


return $this->render( return $this->render(


$this->em->update($user); $this->em->update($user);
$this->em->flush(); $this->em->flush();

$this->addFlash('success', new TranslatableMessage('form.account_password.message.success', [], 'admin'));
} }


return $this->render( return $this->render(

+ 5
- 5
Form/Type/User/ChangePasswordFormType.php View File

'current_password', 'current_password',
PasswordType::class, PasswordType::class,
[ [
'label' => 'form.change_password.current_password',
'label' => 'form.account_password.field.current_password',
'mapped' => false, 'mapped' => false,
'constraints' => [ 'constraints' => [
new NotBlank(), new NotBlank(),
); );


$builder->add( $builder->add(
'plainPassword',
'plain_password',
RepeatedType::class, RepeatedType::class,
[ [
'type' => PasswordType::class, 'type' => PasswordType::class,
'mapped' => false, 'mapped' => false,
'first_options' => ['label' => 'form.change_password.new_password'],
'second_options' => ['label' => 'form.change_password.new_password_repeat'],
'invalid_message' => 'Les deux mots de passe ne correspondent pas.',
'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'),
] ]
); );



+ 11
- 4
Resources/translations/admin.fr.yaml View File

seo: Référencement seo: Référencement


form: form:
change_password:
current_password: Mot de passe actuel
new_password: Nouveau mot de passe
new_password_repeat: Nouveau mot de passe (confirmer)
account_profile:
message:
success: Votre profil a bien été modifié
account_password:
field:
current_password: Mot de passe actuel
new_password: Nouveau mot de passe
new_password_repeat: Nouveau mot de passe (confirmer)
message:
success: Votre mot de passe a bien été modifié
invalid_passwords: Les deux mots de passe ne correspondent pas.

+ 1
- 1
Translation/TranslatorAdmin.php View File

return 'entity.' . $entityName . '.' . $entitySection . '.' . $name; return 'entity.' . $entityName . '.' . $entitySection . '.' . $name;
} }


private function trans($id, $params = [], $domain = self::DOMAIN): string
public function trans($id, $params = [], $domain = self::DOMAIN): string
{ {
return $this->translator->trans($id, $params, $domain); return $this->translator->trans($id, $params, $domain);
} }

Loading…
Cancel
Save