viernes, 25 de octubre de 2013

FOSUserBundle - Parte VI - Overriding Resetting

Aquí son 4 archivos a sustituir:

checkEmail.html.twig
passwordAlreadyRequested.html.twig
request_content.html.twig
reset_content.html.twig

mkdir src/Peteramas/MyFOSUserBundle/Resources/views/Resetting/
cp vendor/friendsofsymfony/user-bundle/FOS/UserBundle/Resources/views/Resetting/checkEmail.html.twig vendor/friendsofsymfony/user-bundle/FOS/UserBundle/Resources/views/Resetting/passwordAlreadyRequested.html.twig vendor/friendsofsymfony/user-bundle/FOS/UserBundle/Resources/views/Resetting/request_content.html.twig vendor/friendsofsymfony/user-bundle/FOS/UserBundle/Resources/views/Resetting/reset_content.html.twig src/Peteramas/MyFOSUserBundle/Resources/views/Resetting/

y luego cambiamos sus contenido a:

checkEmail.html.twig:

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

{% block content -%}
{% trans_default_domain 'FOSUserBundle' %}
<p>
{{ 'resetting.check_email'|trans({'%email%': email}) }}
</p>
{% endblock %}

passwordAlreadyRequested.html.twig

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

{% block content -%}
{% trans_default_domain 'FOSUserBundle' %}
<p>{{ 'resetting.password_already_requested'|trans }}</p>
{% endblock %}

request_content.html.twig

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

{% block content -%}
{% trans_default_domain 'FOSUserBundle' %}
{% if invalid_username is defined %}
<div class="alert alert-danger fade in">
    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
    <strong>Error</strong> {{ 'resetting.request.invalid_username'|trans({'%username%': invalid_username}) }}
</div>
{% endif %}
<form action="{{ path('fos_user_resetting_send_email') }}" method="POST" class="fos_user_resetting_request">
    <div class="form-group">
        <label class="col-sm-2 control-label" for="username">{{ 'resetting.request.username'|trans }}</label>
        <div class="col-sm-10">
            <input class="form-control" id="username" name="username" required="required" type="text" />
        </div>
    </div>
    <div class="form-group">
        <button class="btn btn-primary"type="submit">{{ 'resetting.request.submit'|trans }}</button>
    </div>
</form>
{% endblock %}

reset_content.html.twig

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

{% block content -%}
{% trans_default_domain 'FOSUserBundle' %}
<form action="{{ path('fos_user_resetting_reset', {'token': token}) }}" {{ form_enctype(form) }} method="POST" class="form-horizontal fos_user_resetting_reset" role="form">
    {{ form_errors(form) }}
    <div class="form-group{% if form.plainPassword.first.vars.errors[0].message is defined %} has-error{% endif %}">
        {{ form_label(form.plainPassword.first, null, {'label_attr': {'class': 'col-sm-2 control-label'}}) }}
        <div class="col-sm-10">
            {{ form_widget(form.plainPassword.first, {'attr': {'class': 'form-control'}}) }}
            {% if form.plainPassword.first.vars.errors[0].message is defined %}
            <span class="help-block">
                {{ form.plainPassword.first.vars.errors[0].message }}
            </span>
            {% endif %}
        </div>
    </div>
    <div class="form-group{% if form.plainPassword.second.vars.errors[0].message is defined %} has-error{% endif %}">
        {{ form_label(form.plainPassword.second, null, {'label_attr': {'class': 'col-sm-2 control-label'}}) }}
        <div class="col-sm-10">
            {{ form_widget(form.plainPassword.second, {'attr': {'class': 'form-control'}}) }}
            {% if form.plainPassword.second.vars.errors[0].message is defined %}
            <span class="help-block">
                {{ form.plainPassword.second.vars.errors[0].message }}
            </span>
            {% endif %}
        </div>
    </div>
    <button class="btn btn-primary" type="submit">{{ 'resetting.reset.submit'|trans }}</button>
{{ form_end(form) }}
{% endblock %}

No hay comentarios.:

Publicar un comentario

Puedes comentar como te gustaría que comenten de ti.