Translations for sign up

master
Julien Rosset 1 year ago
parent 9ce4593bc1
commit 5a8a4961de

@ -1,5 +1,6 @@
framework:
validation:
translation_domain: messages
email_validation_mode: html5
# Enables validator auto-mapping support.

@ -133,13 +133,12 @@ class UserController extends AbstractController {
/**
* Sign in a user
*
* @param Request $request The request
* @param AuthenticationUtils $authenticationUtils Security errors from query
*
* @return Response The response
*/
#[Route(path: '/signIn', name: 'user_signIn')]
public function login (Request $request, AuthenticationUtils $authenticationUtils): Response {
public function login (AuthenticationUtils $authenticationUtils): Response {
/** @var User|null $user */
$user = $this->getUser();
if ($user !== null) {

@ -17,7 +17,7 @@ use Symfony\Component\Validator\Constraints as Assert;
* A registered user
*/
#[ORM\Entity(repositoryClass: UserRepository::class)]
#[UniqueEntity(fields: ['email'], message: 'There is already an account with this email')]
#[UniqueEntity(fields: ['email'], message: 'fields.email.errorUnique')]
class User implements UserInterface, PasswordAuthenticatedUserInterface {
use TEntityBase;
@ -25,8 +25,8 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface {
* @var string The email
*/
#[ORM\Column(length: 100, unique: true)]
#[Assert\NotBlank]
#[Assert\Email]
#[Assert\NotBlank(message: 'fields.email.errorEmpty')]
#[Assert\Email(message: 'fields.email.errorInvalid')]
private string $email;
/**
* @var string The hashed password

@ -34,47 +34,48 @@ class SignUpFormType extends AbstractType {
*/
public function buildForm (FormBuilderInterface $builder, array $options): void {
$builder
->add('email')
->add('email', null, [
'label' => 'fields.email.label',
])
->add('newPassword', RepeatedType::class, [
// instead of being set onto the object directly,
// this is read and encoded in the controller
'type' => PasswordType::class,
'mapped' => false,
'attr' => ['autocomplete' => 'new-password'],
'constraints' => [
'type' => PasswordType::class,
'mapped' => false,
'attr' => ['autocomplete' => 'new-password'],
'invalid_message' => 'fields.password.errorMismatch',
'constraints' => [
new NotBlank(
[
'message' => 'Please enter a password',
'message' => 'fields.password.errorEmpty',
]
),
new Length(
[
'min' => 6,
'minMessage' => 'Your password should be at least {{ limit }} characters',
// max length allowed by Symfony for security reasons
'max' => 4096,
'minMessage' => 'fields.password.errorLength',
'max' => 4096, // max length allowed by Symfony for security reasons
]
),
],
'first_options' => [
'label' => 'Password',
'first_options' => [
'label' => 'fields.password.label',
],
'second_options' => [
'label' => 'Password confirmation',
'second_options' => [
'label' => 'fields.password.confirmationLabel',
],
])
->add('agreeTerms', CheckboxType::class, [
'mapped' => false,
'label' => 'fields.agreeTerms.label',
'constraints' => [
new IsTrue(
[
'message' => 'You should agree to our terms.',
'message' => 'fields.agreeTerms.errorNotTrue',
]
),
],
])
->add('submit', SubmitType::class, [
'label' => 'Request account',
'label' => 'fields.signUp',
]);
}
}

@ -16,7 +16,7 @@
<nav class="navbar navbar-expand-lg py-0">
<ul class="navbar-nav">
<li class="nav-item"><a href="{{ path('user_signIn') }}" class="nav-link py-0">{{ 'pages.signIn'|trans }}</a></li>
<li class="nav-item"><a href="{{ path('user_signUp') }}" class="nav-link py-0">{{ 'pages.signUp'|trans }}</a></li>
<li class="nav-item"><a href="{{ path('user_signUp') }}" class="nav-link py-0">{{ 'pages.signUp.title'|trans }}</a></li>
<li class="nav-item dropdown dropstart">
<a class="nav-link dropdown-toggle py-0" id="dropdown-locale" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<img src="{{ asset('images/freakFlagSprite.png') }}"

@ -1,13 +1,10 @@
{% extends 'base.html.twig' %}
{% block title %}Sign Up{% endblock %}
{% block title %}{{ 'pages.signUp.title'|trans }} - {{ parent() }}{% endblock %}
{% block mainContent %}
<h1>Sign up</h1>
<p>
<strong>NOTE :</strong> after confirming your account email, it must be also validated by an administrator
<br>You'll receive an email when your account would be accepted
</p>
<h1>{{ 'pages.signUp.title'|trans }}</h1>
{{ 'pages.signUp.adminValidatorAlert'|trans|raw }}
{{ form(signUpForm) }}
{% endblock %}

@ -16,6 +16,27 @@
<![CDATA[
<p>Welcome on Web EDM, the Web Electronic Document Manager.</p>
<p>Please <a href="{pathSignIn}">Sign In</a> or <a href="{pathSignUp}">Sign Up</a> to start.</p>
]]>
</target>
</segment>
</unit>
</group>
<group id="signUp">
<unit id="title">
<segment>
<source>pages.signUp.title</source>
<target>Sign up</target>
</segment>
</unit>
<unit id="adminValidatorAlert">
<segment>
<source>pages.signUp.adminValidatorAlert</source>
<target>
<![CDATA[
<p>
<strong>NOTE:</strong> after confirming your account email, it must be also validated by an administrator
<br>You'll receive an email when your account would be accepted
</p>
]]>
</target>
</segment>
@ -27,12 +48,6 @@
<target>Sign In</target>
</segment>
</unit>
<unit id="signUp">
<segment>
<source>pages.signUp</source>
<target>Sign Up</target>
</segment>
</unit>
<unit id="signOut">
<segment>
<source>pages.signOut</source>
@ -48,6 +63,24 @@
<target>Email</target>
</segment>
</unit>
<unit id="errorEmpty">
<segment>
<source>fields.email.errorEmpty</source>
<target>Please enter an email</target>
</segment>
</unit>
<unit id="errorInvalid">
<segment>
<source>fields.email.errorInvalid</source>
<target>Please enter a valid email</target>
</segment>
</unit>
<unit id="errorUnique">
<segment>
<source>fields.email.errorUnique</source>
<target>There is already an account with this email</target>
</segment>
</unit>
</group>
<group id="password">
<unit id="label">
@ -56,6 +89,30 @@
<target>Password</target>
</segment>
</unit>
<unit id="confirmationLabel">
<segment>
<source>fields.password.confirmationLabel</source>
<target>Password confirmation</target>
</segment>
</unit>
<unit id="errorEmpty">
<segment>
<source>fields.password.errorEmpty</source>
<target>Please enter a password</target>
</segment>
</unit>
<unit id="errorLength">
<segment>
<source>fields.password.errorLength</source>
<target>Your password should be at least {limit} characters</target>
</segment>
</unit>
<unit id="errorMismatch">
<segment>
<source>fields.password.errorMismatch</source>
<target>The two passwords don't match</target>
</segment>
</unit>
</group>
<group id="rememberMe">
<unit id="label">
@ -65,12 +122,32 @@
</segment>
</unit>
</group>
<group id="agreeTerms">
<unit id="label">
<segment>
<source>fields.agreeTerms.label</source>
<target>Agree terms</target>
</segment>
</unit>
<unit id="errorNotTrue">
<segment>
<source>fields.agreeTerms.errorNotTrue</source>
<target>You should agree to our terms.</target>
</segment>
</unit>
</group>
<unit id="signIn">
<segment>
<source>fields.signIn</source>
<target>Sign In</target>
</segment>
</unit>
<unit id="signUp">
<segment>
<source>fields.signUp</source>
<target>Sign Up</target>
</segment>
</unit>
</group>
</file>
</xliff>

@ -16,6 +16,27 @@
<![CDATA[
<p>Bienvenu sur Web EDM, le gestionnaire de document électronique web.</p>
<p>Merci de vous <a href="{pathSignIn}">connecter</a> ou <a href="{pathSignUp}">créer un compte</a> pour commencer.</p>
]]>
</target>
</segment>
</unit>
</group>
<group id="signUp">
<unit id="title">
<segment>
<source>pages.signUp.title</source>
<target>S'enregistrer</target>
</segment>
</unit>
<unit id="adminValidatorAlert">
<segment>
<source>pages.signUp.adminValidatorAlert</source>
<target>
<![CDATA[
<p>
<strong>NOTE :</strong> après avoir validé votre adresse mail, votre compte doit également être validé par un administrateur.
<br>Vous recevrez un mail quand ça sera le cas.
</p>
]]>
</target>
</segment>
@ -27,12 +48,6 @@
<target>Connexion</target>
</segment>
</unit>
<unit id="signUp">
<segment>
<source>pages.signUp</source>
<target>Nouveau compte</target>
</segment>
</unit>
<unit id="signOut">
<segment>
<source>pages.signOut</source>
@ -48,6 +63,24 @@
<target>Email</target>
</segment>
</unit>
<unit id="errorEmpty">
<segment>
<source>fields.email.errorEmpty</source>
<target>Veuillez saisir un email</target>
</segment>
</unit>
<unit id="errorInvalid">
<segment>
<source>fields.email.errorInvalid</source>
<target>Veuillez saisir un email valide</target>
</segment>
</unit>
<unit id="errorUnique">
<segment>
<source>fields.email.errorUnique</source>
<target>Il existe déjà un compte avec cette adresse mail</target>
</segment>
</unit>
</group>
<group id="password">
<unit id="label">
@ -56,6 +89,30 @@
<target>Mot de passe</target>
</segment>
</unit>
<unit id="confirmationLabel">
<segment>
<source>fields.password.confirmationLabel</source>
<target>Confirmation mot de passe</target>
</segment>
</unit>
<unit id="errorEmpty">
<segment>
<source>fields.password.errorEmpty</source>
<target>Veuillez saisir un mot de passe</target>
</segment>
</unit>
<unit id="errorLength">
<segment>
<source>fields.password.errorLength</source>
<target>Votre mot de passe doit avoir au minimum {limit} caractères</target>
</segment>
</unit>
<unit id="errorMismatch">
<segment>
<source>fields.password.errorMismatch</source>
<target>Les deux mots de passe ne sont pas identiques</target>
</segment>
</unit>
</group>
<group id="rememberMe">
<unit id="label">
@ -65,12 +122,32 @@
</segment>
</unit>
</group>
<group id="agreeTerms">
<unit id="label">
<segment>
<source>fields.agreeTerms.label</source>
<target>Accepter les conditions</target>
</segment>
</unit>
<unit id="errorNotTrue">
<segment>
<source>fields.agreeTerms.errorNotTrue</source>
<target>Vous devez accepter nos conditions</target>
</segment>
</unit>
</group>
<unit id="signIn">
<segment>
<source>fields.signIn</source>
<target>Connexion</target>
</segment>
</unit>
<unit id="signUp">
<segment>
<source>fields.signUp</source>
<target>S'enregistrer</target>
</segment>
</unit>
</group>
</file>
</xliff>
Loading…
Cancel
Save