FOSUserBundle: Override resetting templates / Problem with route token

Hello,

Reference: #878 (is closed!?)

Problem is:

An exception has been thrown during the rendering of a template
("Some mandatory parameters are missing ("token") to generate
a URL for route "fos_user_resetting_reset".") in
FOSUserBundle:Resetting:reset.html.twig at line 4.

The templates be total normal … Information: I could override ALL templates except the one with the “token” parameter. And second information: I could override the templates “normal” without “extends” or “include” tags… Then everythink is okay. But if i use extends or include tag i get the error =.=

FOSUserBundle:Resetting:reset.html.twig

{% extends "FOSUserBundle::layout.html.twig" %}

{% block fos_user_content %}
    {% include "FOSUserBundle:Resetting:reset_content.html.twig" %}
{% endblock fos_user_content %}

FOSUserBundle:Resetting:reset_content.html.twig

{% extends "FOSUserBundle::layout.html.twig" %}

{% block contentmain %}
    <form action="{{ path('fos_user_resetting_reset', {'token': token|default('123abc')}) }}" {{ form_enctype(form) }} method="POST">
        {{ form_widget(form) }}
        <div>
            <input type="submit" value="{{ 'resetting.reset.submit'|trans }}" />
        </div>
    </form>
{% endblock %}

FOSUserBundle::layout.html.twig

{% extends '::base.html.twig' %}

{% block contentmain %}
    {% block fos_user_content %}{% endblock %}
{% endblock %}

Dont know why there is a problem with this… Only one parameter in route…

About this issue

  • Original URL
  • State: closed
  • Created 11 years ago
  • Comments: 18 (2 by maintainers)

Most upvoted comments

try This

{% trans_default_domain 'FOSUserBundle' %}
<form id="form-reset-pwd" action="{{ path('fos_user_resetting_reset', {'token': token}) }}" {{ form_enctype(form) }} method="POST" class="fos_user_resetting_reset">
    <div class="form-group form-group-default">
        <div class="controls">
            <div id="fos_user_resetting_form">
                <div>
                    <input type="password" id="fos_user_resetting_form_plainPassword_first" class="form-control" name="fos_user_resetting_form[plainPassword][first]" placeholder="New password" required="required" aria-required="true">
                </div>
            </div>
        </div>
    </div>
    <div class="form-group form-group-default">
        <div class="controls">
            <div id="fos_user_resetting_form">
                <div>
                    <input type="password" id="fos_user_resetting_form_plainPassword_second" class="form-control" name="fos_user_resetting_form[plainPassword][second]" placeholder="Repeat new password" required="required" aria-required="true">
                </div>
            </div>
        </div>
    </div>
    <button id="validate-login" type="submit" value="{{ 'resetting.reset.submit'|trans }}" class="btn btn-orange btn-cons btn-animated from-left fa fa-arrow-right action submit" style="display: block;">
        <span>{{ 'resetting.reset.submit'|trans }}</span>
    </button>
    {{ form_row(form._token) }}
</form>

@ibasaw you can overwrite the template. The only thing is that your overwritten template must generate the route properly (i.e. passing the mandatory parameters) instead of just generating the route name without parameters.

ok

so, how can i have the reset form in my website with my look and feel ?

How do you do guys to do this ?

Do i copy/paste the whole base html twig to get the same result and include the form in it ? (seem bad and dirty)