How can I force FOSUserBundle to render all its pages as a part of my global template.
i tried to insert layout.html.twig from FOS UB to {% block login %} in my ::base.html.twig file which is above my default content in {% block body %}. when user enters page and logs in its ok but if he make for example password error he see only login form not the whole page.
I have also overriden layout of FOS UB to extend ::base.html.twig but how to make next steps?
Check Override template section of the doc.
Edit
Login action redirection is done by Symfony's internal Authentication/firewall system. If you enter wrong password the Symfony automatically redirects to login action you defined in firewall. For more info you can check Security section of the book. In this case you have to modify login.html.twig of FOSUserBundle to use your base template.
Related
I want to integrate my existing app, say a forum into Django CMS.
The problem is I don't want users to have any Django CMS capabilites.
They should not be able to see the edit bar or anything Django CMS related.
I only want them to have access to other Django apps. No Django CMS specific things like pages, plugins etc.
Is it possible? How?
The simplest way would be to restrict the CMS toolbar to super users;
{% if request.user.is_authenticated and request.user.is_superuser %}
{% cms_toolbar %}
{% endif %}
The toolbar is also part of the request object so in your app views you could disable it by doing something like request.toolbar.show_toolbar = False (docs)
I am working with Sylius e-commerce (Symfony 2), and I want to know is it possible to check is my route accessed.
For example if I have 3 kind of routes :
../aboutus.. /home.. /contact
and how I could check if my /home is accessed so I can do some actions about that.
Thanks,
Cheers
I think that I've found solution to this, in a twig.template you can do this:
{{ app.request.get('_route') }}
that returns path of accessed route
I have installed FOSUserBundle. Now I would like to have two different templates for the same login action: one for the login in the layout and the other one for a standalone login page.
What is the way to do this?
You can leave the login form from FOSUserBundle as is (or overwrite it by moving it to app/Resources). This form will be used for the standalone login page. For other sections of the website you can create a new login form in twig yourself, the important thing is that your form will need to have all the fields named like the one from FOSUserBundle and to have the action path set to the login check page (because your using FOSUserBundle the path is "fos_user_security_check").
The names for the fields you will find here:
https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/views/Security/login.html.twig
You can see that you need also a generated csrfToken. You can generate it in your controller, also inspired by the guys from FOSUserBundle: https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Controller/SecurityController.php#L43
I'm working on Symfony2 and SonataAdminBundle.
I need to add a module in my admin for send email to all users.
So, i need a new page with a link in the menu.. How can i do that simply ?
Fow now i have my blocks in my dashboard, so one one page..
I'm having a wordpress site(still offline) which is basically a news paper site. Users has to registered to comment. My problem is that when users login for commenting on any article, they are redirected to profile page (or to home page if i use some plugins)... but the standard should be redirecting them to the referring page as to comment on that was the reason they logged in. What is the solution for this?
And another thing is the user profile, my site actually don't need a user profile but need option to change the password. By default the profile is same like the wp dashboard, how do i template it? Is it author.php file that i have to work on?
Regarding the redirection. You can simply specify the wp login url, where it should take them after they login..
For example.
Login
Takes you to the current page, after the login.. So place a link after the comment.
for disabling profile page modify wp-admin/profile.php like
define('IS_PROFILE_PAGE', true);
Change to:
define('IS_PROFILE_PAGE', false);
I hope you can find the wp comments login link easily in template files.