What I am trying to do is nothing hard. This is my first project on symfony and it's really confusing.
I am using FOSUSerbundle. I dont want to have a login and registration bellow /login and /registration
So I made a bundle which is child of FOSUSerbundle ... and it overrides its twigs.
I have ::base.html.twig where I include header.html.twig and there I have: {% render 'FOSUserBundle:Security:login' %} which render my teplate (overrided the FOS one) works gr8. Even the errors after submiting are rendering on the ::base template bellow "/" route.
#Security.yml
form_login:
check_path: /login_check
login_path: /
provider: fos_userbundle
Works great.
And I need to do exactly that same for my registration.
So in ::base I include welcome_page.html.twig where I code {% render 'FOSUserBundle:Registration:register' %} and there I have under my rewrited template: WelcomePageBundle:Registration:register.html.twig this:
{% block fos_user_content %}
{% include "FOSUserBundle:Registration:register_content.html.twig" %}
{% endblock fos_user_content %}[/code]
which also include from MY rewrited bundle: WelcomePageBundle:Registration:register_content.html.twig this:
{% for key, message in app.session.getFlashes() %}
<div class="{{ key }}">
{{ message|trans({}, 'FOSUserBundle') }}
</div>
{% endfor %}
<form action="{{ path('fos_user_registration_register') }}" {{ form_enctype(form) }} method="POST" id="register_form">
{{ form_widget(form) }}
{{ form_rest(form) }}
<input type="submit" class="registration_submit" value="{{ 'welcome_page.registration_box.register_submit'|trans }}"/>
</form>
<div class="v_pripade">
{{ 'welcome_page.registration_box.with_reg_problems'|trans }}
<span style='color: #fff568'>{{ 'welcome_page.registration_box.with_reg_problems_part2'|trans }}</span>
</div>
Everything works like a charm... all the files are included and displayed greate. But the problem comes now.
When I go to route /register
(which is basic route from FOS bundle)
<route id="fos_user_registration_register" pattern="/register">
<default key="_controller">FOSUserBundle:Registration:register</default>
</route>
... fill data and click submit... it works. The errors are displayed or registration is succes..
But when I submit form from my route / where the registration controller is rendered (rendered ok) it takes my to this route :/register which is normal behaviour because this path:
<form action="{{ path('fos_user_registration_register') }}" {{ form_enctype(form) }} method="POST" id="register_form">
... this site isn't extended by nothing so its just clean form on white page with errors... OK
But how can I possible make work this form with displaying errors and success ON MY ::base template like the login? and dont go to /register route? I tried replace /register for / which bring me to my ::base template (like in login I do).
#security.yml
form_login:
check_path: /login_check
login_path: /
provider: fos_userbundle
But none of the errors or success are displayed ...
Do anyone know solution?