fosuserbundle

Anonymous token even if logged in in public pages

我怕爱的太早我们不能终老 提交于 2019-12-11 08:38:54
问题 I'm having some trouble setting my security. I want a page to be accessible both by anonymous and by logged in members. I want it to show different content depending on the situation (in fact, i want to still be logged in as a member when i go on it). The page I want to give public access is ^/profile. I set my security.yml like that : jms_security_extra: secure_all_services: false expressions: true security: encoders: Symfony\Component\Security\Core\User\User: plaintext FOS\UserBundle\Model

symfony2 how to implement AdvancedUserInterface on User class that extends BaseUser?

為{幸葍}努か 提交于 2019-12-11 06:29:41
问题 I have a custom User class that extends the BaseUser. I have been informed that in order to make use of the user lock functions my user class needs to implement the AdvancedUserInterface, but it seems I can't do both EXTENDS and IMPLEMENTS on the User class? <?php // src/BizTV/UserBundle/Entity/User.php namespace BizTV\UserBundle\Entity; use BizTV\UserBundle\Validator\Constraints as BizTVAssert; use Symfony\Component\Security\Core\User\AdvancedUserInterface; use FOS\UserBundle\Entity\User as

Where is config.yml for FOSUserBundle configuration located in Flex?

强颜欢笑 提交于 2019-12-11 06:29:07
问题 I am trying to include FOSUserBundle in my Symfony application. The doc mentions an app/config/config.yml file, but there is none in my application. I think it's because I have a Flex structure. Anyone knows where I should put the fos_user configuration in my app? 回答1: The config file should be config/packages/fos_user.yaml with the symfony flex structure. The friendsofsymfony/user-bundle recipe's pull request is still not merged as of 2018-01-25. 来源: https://stackoverflow.com/questions

Remove mapped doctrine field of parentclass in Symfony [FOSUserBundle]

隐身守侯 提交于 2019-12-11 05:28:46
问题 How is it possible to remove a field that got inherited as doctrine column from mapping? Example: In FosUserBundle, I don't need some of the columns (e.g. salt, expiresAt...) within my User class. How can I tell symfony/doctrine to not map this column anymore to the database / remove it from the mapping? I know how to "reconfigure" the columns by using @AttributeOverride, but how can I completly remove a field from the mapping? Regards. 回答1: Pretty much all default properties of the FOSUB

Jms serializer annotations as yaml file

China☆狼群 提交于 2019-12-11 04:23:12
问题 I've been working on User class inherited from BaseUser of FOSUserBundle , so I've faced a problem. I need to set up serialization for my User but JMS serializer serializes all properties of BaseUser . Solution that I found was to create my own annotation for BaseUser and store it in yaml file, but I don't know how exactly should I do this. 回答1: JMSSerializerBundle by default use your AcmeBundle/Resources/config/serializer directory to fetch all metadata that are declared in yml or xml files.

Programmatically logout current user

和自甴很熟 提交于 2019-12-11 03:38:32
问题 I am trying to programmatically logout the current user from inside a listener. I read here that $this->get('security.context')->setToken(null); $this->get('request')->getSession()->invalidate(); does the trick but then I can't call $this->container->get('security.context')->getToken()->getUser(); anymore as the token is now NULL . How can I log out the user but still let the application run normally? I have calls to getUser() in my controller functions so I should set back the token to

Symfony 2 with PUGXMultiUserBundle and multi login form

≯℡__Kan透↙ 提交于 2019-12-11 03:15:24
问题 here my problem : I have two categories of users in my application (locataires and propriétaires), and i need one (or two) login form. I use PUGXMultiUserBundle to manage all my users. here is the view for loggin "proprietaires" : {% extends "::layout.html.twig" %} {% block title %} Nous contacter - {{ parent() }} {% endblock %} {# Contents #} {% block body %} <div class="row"> <div class="col-md-12"> <div class="well"> <form action="{{ path('proprietaire_login_check') }}" method="post">

Overriding “Change Password” Template from FOS User Bundle

我与影子孤独终老i 提交于 2019-12-11 02:52:03
问题 I did some research and sadly couldn't find any help for that. So I'm rendering the FOSUserBundle ChangePasswordAction into a template of mine, but it displays the default template given from the vendor. My template where the controller is rendered: {% block body %} <h2>Einstellungen</h2> <br/> <h4>Ändern Sie ihr Passwort</h4> {% render controller("FOSUserBundle:ChangePassword:changePassword") %} {% endblock %} My template for the ChangePasswordAction, the path is app/Resources/FOSUserBundle

Execute function after User Login Symfony 2.3

青春壹個敷衍的年華 提交于 2019-12-11 02:42:01
问题 I am trying to execute a function after user login in FOSUserBundle, in my config.yml I set the service: services: authentication.success.listener: class: MyCompany\MyBundle\EventListener\AuthenticationEventListener arguments: [@router] tags: - { name: kernel.event_subscriber } Then, I create the Listener class with the methods: <?php namespace MyCompany\MyBundle\EventListener; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\Routing\Generator

How to define/pass the entity manager for sonata-admin

萝らか妹 提交于 2019-12-11 01:39:21
问题 I followed this tutorial to install SonataAdmin with FOSUserBundle. Now i keep getting this Error Message: No entity manager defined for class Application\Sonata\UserBundle\Entity\User But how do i set/pass the EntityManager? I haven't found anything about configuring it or any hint on what this error means. Any help anyone? Edit #1: As asked for, here is what i have in my config.yml for sonata so far: sonata_block: default_contexts: [cms] blocks: sonata.admin.block.admin_list: contexts: