Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On login page, register form gets embedded in base layout (resulting in two nested base layout) #412

Closed
zedrdave opened this issue May 22, 2014 · 9 comments

Comments

@zedrdave
Copy link

While trying to figure why my login page would have two nested base layouts, I narrowed it down to SonataUserBundle / Resources / views / Security / base_login.html.twig, which calls:

{% render controller("SonataUserBundle:RegistrationFOSUser1:register") %}

But then the controller renders the form by calling:

        return $this->container->get('templating')->renderResponse('FOSUserBundle:Registration:register.html.'.$this->getEngine(), array(
            'form' => $form->createView(),
        ));

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

... resulting in nested base layouts...

Am I missing something or is there a bug somewhere?

net02 added a commit to net02/SonataUserBundle that referenced this issue May 27, 2014
net02 added a commit to net02/SonataUserBundle that referenced this issue May 27, 2014
Fixing sonata-project#412 and an issue with `security.context` having a _null_ token
@cassianotartari
Copy link
Contributor

+1

1 similar comment
@webdevilopers
Copy link

👍

@webdevilopers
Copy link

I updated my base_login.html.twig but still facing the issue. My current template is located in app/Resources/SonataUserBundle/views/layout.html.twig and is simply based on the AcmeDemoBundle:

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

{% block body %}

    {{ block('fos_user_content') }}

{% endblock %}

The result looks like this:
bildschirmfoto vom 2014-09-17 17 00 41

Any idea?

@webdevilopers
Copy link

I could narrow down my issue to the FOS User Bundle register view.

Original view **register.html.twig'':

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

{% block fos_user_content %}
{% include "FOSUserBundle:Registration:register_content.html.twig" %}
{% endblock fos_user_content %}

Causes:
bildschirmfoto vom 2014-09-22 11 48 56

Removing the layout extension:

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

{% block fos_user_content %}
{% include "FOSUserBundle:Registration:register_content.html.twig" %}
{% endblock fos_user_content %}

shows the correct result:
bildschirmfoto vom 2014-09-22 11 49 11

Is this an FOS issue?

@webdevilopers
Copy link

@stof Do you have an idea?

@yanict
Copy link

yanict commented Jan 29, 2015

that will break if you don't fill the register form properly.
try using 2 different passwords, only the register.html.twig willl be loaded and that will make the layout disappear.
i'm still looking for a solution, if anyone has a good one ?

thanks

@kaayru
Copy link

kaayru commented Apr 30, 2015

I was struggling with the same issue. To fix it, I did override the problematic template with the following one:

app/Resources/FOSUserBundle/views/Registration/register.html.twig

With the same content as in the original one, without extending any layout:

{% block fos_user_content %}
{% include "FOSUserBundle:Registration:register_content.html.twig" %}
{% endblock fos_user_content %}

Did the trick for me!

net02 added a commit to net02/SonataUserBundle that referenced this issue Jun 12, 2015
Fixing sonata-project#412 and an issue with `security.context` having a _null_ token
with "non-standard" security.yml configuration the login/register page could be behind no firewall, implying there won't be any token from the security.context service
@jontorrado
Copy link

That's not the solution because if you do not modify the /register controller or layout, that page will result in a no-layout registration form. Another solution is to modify the controller being executed for your own:

{% block sonata_user_registration %}
    {% render controller("SonataUserBundle:RegistrationFOSUser1:register") %}
{% endblock %}

Then just render the same template as register.html.twig but without the extends.

@core23
Copy link
Member

core23 commented Mar 15, 2019

This issue is very old. Can you please check this against the latest stable / master version?

Feel free to reopen, if the error still exists.

A PR would be welcome if you reopen this issue.

@core23 core23 closed this as completed Mar 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants