简体   繁体   中英

FOSUserBundle: resetting template not replacing %email%

The page displayed after clicking on Reset password button contains

An email has been sent to %email%.

The check_email.html.twig template is overridden at .../app/Resources/FOSUserBundle/view/Resetting and contains

{% extends 'layout.html.twig' %}

{% trans_default_domain 'FOSUserBundle' %}

{% block fos_user_content %}
<p>
{{ 'resetting.check_email'|trans({'%tokenLifetime%': tokenLifetime})|nl2br }}
</p>
{% endblock %}

config.yml contains

    framework:
        translator:      ~
    ...
    fos_user:
        db_driver: orm # other valid values are 'mongodb', 'couchdb' and 'propel'
        firewall_name: main
        user_class: 'AppBundle\Entity\User'
        from_email:
            address:        admin@projectmana.org
            sender_name:    Application Support
        service:
            mailer: fos_user.mailer.twig_swift
        resetting:
            email:
                template: email/password_resetting.email.twig

FOSUserBundle.en.yml is in place at .../app/Resources/translations

FOSUserBundle installed is dev-master 03ce036 .

The page is not able to translate the %email% key since you have not specified it in the content of the check_email twig. Your template should contain something like: {{ 'resetting.check_email'|trans({'%email%': email}, 'FOSUserBundle') }}

The eventual solution was to require v2.0.0-beta1 in composer and/or get rid of the override of the translator file. A good clearing of cache helps, too.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM