浏览代码

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

tags/0.1
Fab 3 年前
父节点
当前提交
8c68c0df0f
共有 4 个文件被更改,包括 22 次插入10 次删除
  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 查看文件

@@ -12,6 +12,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
use Symfony\Component\Translation\TranslatableMessage;

class UserController extends AbstractController
{
@@ -34,6 +35,8 @@ class UserController extends AbstractController

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

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

return $this->render(
@@ -62,6 +65,8 @@ class UserController extends AbstractController

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

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

return $this->render(

+ 5
- 5
Form/Type/User/ChangePasswordFormType.php 查看文件

@@ -53,7 +53,7 @@ class ChangePasswordFormType extends AbstractType
'current_password',
PasswordType::class,
[
'label' => 'form.change_password.current_password',
'label' => 'form.account_password.field.current_password',
'mapped' => false,
'constraints' => [
new NotBlank(),
@@ -63,14 +63,14 @@ class ChangePasswordFormType extends AbstractType
);

$builder->add(
'plainPassword',
'plain_password',
RepeatedType::class,
[
'type' => PasswordType::class,
'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 查看文件

@@ -73,7 +73,14 @@ entity:
seo: Référencement

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 查看文件

@@ -122,7 +122,7 @@ class TranslatorAdmin
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);
}

正在加载...
取消
保存