fosuserbundle

Symfony2: Inject current user in Service

为君一笑 提交于 2019-12-29 18:35:06
问题 I am trying to inject the currently logged in user into a service. My goal is to extend some twig functionality to output it based on user preferences. In this example I want to output any date function using the user specific Timezone. There doesn't seem to be any way to inject the current user into a service, which seems really odd to me. When injecting the security context, it doesn't have a token even if the user is logged in I am using FOS user bundle. services: ... twigdate.listener

Symfony2: Inject current user in Service

删除回忆录丶 提交于 2019-12-29 18:34:30
问题 I am trying to inject the currently logged in user into a service. My goal is to extend some twig functionality to output it based on user preferences. In this example I want to output any date function using the user specific Timezone. There doesn't seem to be any way to inject the current user into a service, which seems really odd to me. When injecting the security context, it doesn't have a token even if the user is logged in I am using FOS user bundle. services: ... twigdate.listener

Vendor updates broke FOS User Bundle with “Call to a member function has() on a non-object”

拜拜、爱过 提交于 2019-12-29 08:48:07
问题 I updated my vendors for a Symfony 2.8 project and suddenly the login page isn't loading – instead I get this: Error: Call to a member function has() on a non-object in vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php at line 184 "name": "hazardlog", "license": "proprietary", "type": "project", "autoload": { "psr-4": { "": "src/" }, "classmap": [ "app/AppKernel.php", "app/AppCache.php" ] }, "repositories": [ { "type": "package", "package": { "name": "jquery

Symfony FOSUserBundle Remeber me doesn't work

*爱你&永不变心* 提交于 2019-12-25 17:00:13
问题 I'm using FOSUserBundle with email as username. Tryin' to use the remember_me functionality but it's not working. I've read this Symfony2: "Remember me" tries to authenticate by username instad of email It's quite an old article and the username field in the database is set with the same value as the email so i don't understand why it is not working. Checking with Google Chrome Inspector the REMEMBERME cookie is set... Can someone help? This is my security.yaml providers: fos_userbundle: id:

FOSUserBundle Unique Entity constraints

匆匆过客 提交于 2019-12-25 08:34:53
问题 I want to set up a unique constraint on the fields "username" and "email" but it doesn't work : use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; use FOS\UserBundle\Model\User as BaseUser; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; /** * @ORM\Table(name="acteurs") * @ORM\Entity(repositoryClass="UserBundle\Repository\ActeurRepository") * @ORM\InheritanceType("JOINED") * @UniqueEntity(fields="email", message="Cet email existe déjà.") *

symfony fosuserbundle redirection after login

强颜欢笑 提交于 2019-12-25 07:52:36
问题 i have a login form what i want to do that if a user have role user tries to login he's redirected to page voiture_new and if an admin eventually has a role admin he's redirected to the admin page PS : i'm using easyadminbundle here's what i've added to the loginaction of my controller $authChecker = $this->container- >get('security.authorization_checker'); $router = $this->container->get('router'); if ($authChecker->isGranted('ROLE_ADMIN')) { return new RedirectResponse($router->generate(

Symfony2 (FOSUserBundle Registration form) One to one relation between User class and another class

纵然是瞬间 提交于 2019-12-25 06:47:35
问题 I've found a similar question but the reported solution didn't work for me. Here is the link: FOSUserBundle One-To-One mapped Entity not saved Probably I'm missing something. Current situation: I'm using the FOSUserBundle to register new users. The users' data are split between two tables with corresponding Entities and ONE TO ONE relation (one table contains the authentication credentials and the other one the users' profile data like name/surname etc). I've overwritten the basic

Session in different applications Symfony2

隐身守侯 提交于 2019-12-25 03:27:14
问题 I have three Symfony2 applications running on different servers, I can not keep me logged in on more than one application at the same time. When I do I log into one of the applications automatically when I try to access another application in which I was already logged in I am required to login again. I believe they are sharing a session ID or something. Could someone enlighten me what happens and how to solve this problem? Thank you 来源: https://stackoverflow.com/questions/24891328/session-in

Session in different applications Symfony2

邮差的信 提交于 2019-12-25 03:27:13
问题 I have three Symfony2 applications running on different servers, I can not keep me logged in on more than one application at the same time. When I do I log into one of the applications automatically when I try to access another application in which I was already logged in I am required to login again. I believe they are sharing a session ID or something. Could someone enlighten me what happens and how to solve this problem? Thank you 来源: https://stackoverflow.com/questions/24891328/session-in

Authenticated LDAP password not being stored in fos_user database

梦想的初衷 提交于 2019-12-25 03:15:08
问题 I have a Symfony project with FOSUserBundle and FR3DLdapBundle registered and configured, but when I authenticate against a test LDAP server, the authetication works, but when I look at the dev.log the Doctrine insert statement does not have a password (it's blank). This is the bottom of my config.yml file: fr3d_ldap: driver: host: ldap.forumsys.com user: baseDn: dc=example, dc=com attributes: - { ldap_attr: uid, user_method: setUsername } - { ldap_attr: mail, user_method: setEmail } - { ldap