fosuserbundle

Adding extended profile entity to FOS UserBundle

纵然是瞬间 提交于 2019-12-04 11:17:16
问题 I am trying to extend the FOS UserBundle to allow for extended profile entities to hold additional information in addition to the basic UserBundle fields. Because I have multiple types of users on the site I have created separate entities to hold the profile information. I have the entities set up as follows: class UserProfile { /** * @var integer */ private $id; /** * @var integer */ private $userId; /** * @var string */ private $phone; /** * @var string */ private $language; /** * @var

Symfony 2 FOS User Bundle Bootstrap modal AJAX Login

核能气质少年 提交于 2019-12-04 10:33:24
问题 Has anyone already built a login form inside a Bootstrap modal with Symfony 2 and FOS User Bundle ? Here is what I have now : src/Webibli/UserBundle/Resources/config/service.yml authentication_handler: class: Webibli\UserBundle\Handler\AuthenticationHandler arguments: [@router, @security.context, @fos_user.user_manager, @service_container] app/config/security.yml form_login: provider: fos_userbundle success_handler: authentication_handler failure_handler: authentication_handler src/Webibli

Ignore Password when user updates profile with FOSUserBundle

会有一股神秘感。 提交于 2019-12-04 10:15:11
I am using FOSUserBundle and I am trying to create a page that allows a user to update their user profile. The problem I am facing is that my form does not require that the user reenter their password if they don't want to change/update their password. So when a user submits the form with an empty password the database will be updated with an empty string, and the user will not be able to log in. How can I get my form to ignore updating the password field if it is not set? Below is the code I am using. $user = $this->get('security.context')->getToken()->getUser(); //user form has email and

Symfony 2 FOSUserBundle with rest login and registration

﹥>﹥吖頭↗ 提交于 2019-12-04 08:23:06
问题 I have gone through lots of stackoveflow question and articles, but can't find a suitable answer. I'm using fosuserbundle, hwiouthbundle and lexikjwt bundle. I'm developing an api based on symfony which will be consumed by an android app and angular app. Now I need the register and login system with fosuserbundle facebook login with hwiouthbundle and api protection with lexikjwt bundle. I have implemented fosuserbundle and hwiouthbundke and both working without even writing user controller.

Bug into fosuserbundle when double click on confirmation link?

邮差的信 提交于 2019-12-04 06:12:44
I just begin to use fosuserbundle, today I activate the confirmation register link. It works great, but if the user click a second time on the confirmation link in the email, he get that error : The user with confirmation token "3hiqollkisg0s4ck4w8g0gw4soc0wwoo8ko084o4ww4sss8o4" does not exist 404 Not Found - NotFoundHttpException I think this error should be handle by the bundle, no ? Thanks Here's the code for overriding the action. Basically just copied part of the actual FOS action and modded. Create a RegistrationController.php file in your user bundle's controller folder and put the

How to use the credentials expired property in Symfony AdvancedUserInterface?

巧了我就是萌 提交于 2019-12-04 06:00:38
In a Symfony 2.4 project our client wants to force the users to change their password every N days. We saw that there are columns "credentials_expired" and "credentials_expire_at" in the database and a check that throws an AccountExpiredException in the UserChecker class that seem to be for that purpose, but I can't find any documentation on how to enable or configure this feature. How can the credentials_expire_at column be filled with a date N days after now on every password change? How can a user still change the password, if the password is expired? How to warn the user about the

How to access the user Token in an injected service to reencode passwords?

大兔子大兔子 提交于 2019-12-04 04:33:15
问题 I have the below code where I am trying to re-encode passwords as users log in (the database has bee migrated form a legacy website). However, I'm not sure what I'm doing wrong as I keep getting errors: Attempted to call an undefined method named "forward" of class "AppBundle\Service\HubAuthenticator". I have set things up as follows: security.yml security: encoders: AppBundle\Entity\Member: id: club.hub_authenticator services.yml services: //This should be central service than then calls the

symfony2 : using referer after login with fosuserbundle

蓝咒 提交于 2019-12-04 03:44:28
I've got problem with fosuserbundle to redirect user to the referer after login success app/config/security.yml security: encoders: FOS\UserBundle\Model\UserInterface: sha512 role_hierarchy: ROLE_ADMIN: ROLE_USER ROLE_SUPER_ADMIN: ROLE_ADMIN providers: fos_userbundle: id: fos_user.user_provider.username_email firewalls: main: pattern: ^/ form_login: provider: fos_userbundle login_path: fos_user_security_login use_referer: true check_path: fos_user_security_check csrf_provider: form.csrf_provider logout: path: fos_user_security_logout anonymous: true access_control: - { path: ^/%locale%/login$,

Symfony2 access user and doctrine in a service

只谈情不闲聊 提交于 2019-12-04 03:38:51
I'm running the equivalent of this code in lots and lots of controller actions, basically it grabs the user's username, and if that username is attached to a blog entity it will allow the user to see the blog entity(s): $em = $this->getDoctrine()->getManager(); $user = $this->get('security.context')->getToken()->getUser(); $entities = $em->getRepository('MySiteBundle:Blog')->findBy(array('user' => $user)); return $this->render('MySiteBundle:Blog:index.html.twig', array( 'entities' => $entities, I want to move it into a service so I can cut down on code repetition. I want to avoid doing as much

How create modal window with Twig template and Twitter-Bootstrap

送分小仙女□ 提交于 2019-12-04 03:33:34
I use Symfony and boostrap to customize the style of my website. I have a twig file : register_content.html.twig which contains a register form. In my index.html.twig I want to have something like that : <a href="{{ path('fos_user_registration_register') }}" class="btn" data-toggle="modal">Je m'inscris !</a> To display the content of the register form in a modal window, but it doesn't work. I try to use the twitter-bootstrap documentation here : http://bootstrap.braincrafted.com/javascript#modals But I can't find a way to apply it easily for twig in symfony... Could you help me ? Thanks