fosuserbundle

fosuserbundle override login action

痞子三分冷 提交于 2019-12-01 04:44:49
I am using FSOUserBundle and I want to override loginAction, I used this method: namespace PjDZ\UserBundle\Controller; use FOS\UserBundle\Controller\SecurityController as BaseController; class SecurityController extends BaseController { public function loginAction(\Symfony\Component\HttpFoundation\Request $request) { /** @var $session \Symfony\Component\HttpFoundation\Session\Session */ $session = $request->getSession(); // get the error if any (works with forward and redirect -- see below) if ($request->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) { $error = $request->attributes-

FosUserbundle and symfony 2 template and edits

白昼怎懂夜的黑 提交于 2019-12-01 01:57:26
I am new to symfony 2. I have just setup with basic FOSuserbundle. But I have a few problems: I have setup the new layout template but I could not find where to change the form template for login, registration, profile I could not find how to edit the user profile. I can view the profile using /profile but I could not find any edit link there Answers on your questions you can find inside documentation . Here are some points: Copy templates you want to modify from FOSUserBundle/Resources/views into your bundle and do changes you want. If you need to make a custom profile form (as I guess based

FOSUserBundle admin area not accessible after login

放肆的年华 提交于 2019-12-01 01:45:15
I am using FOSUserBundle for admin section as well as frontend by following the instructions given at: https://github.com/FriendsOfSymfony/FOSUserBundle/issues/849 For frontend everything is working fine but for admin section when i access my admin area /admin then i am redirected to login page /admin/login (that is correct). Once i provide admin username and password then as per the default target path of after login default_target_path: /admin/ defined in security.yml it is redirecting to /admin (that is also correct) but i am getting 403 forbidden error **Access Denied** 403 Forbidden -

How to get userid from eventlistener which are called from AJAX

六月ゝ 毕业季﹏ 提交于 2019-12-01 00:43:54
问题 I am using symfony2 and FOSUserBundle. Normally,I can get user data from Controller $user = $this->get('security.context')->getToken()->getUser(); or $user = $this->container->get('security.context')->getToken()->getUser(); But now,I want to get the userdata from eventlistner which are called from Ajax. Is it possible? or not? my source is here. namespace Acme\MemberBundle\EventListener; use ADesigns\CalendarBundle\Event\CalendarEvent; use ADesigns\CalendarBundle\Entity\EventEntity; use

Symfony impersonation - separate firewalls and separate user providers

让人想犯罪 __ 提交于 2019-11-30 22:24:38
I have a Symfony application with two firewalls, one for admins and one for normal users. admin: provider: admin # etc main_site: form_login: provider: fos_userbundle csrf_provider: form.csrf_provider I'd like admin users to be able to impersonate normal users. How can I do this, given that they're using separate firewalls and separate user providers? Sam There were several things I had to do to get this to work. Context key: As described here , I had to give both firewalls the same context. Without this, admins were taken to the login page when trying to switch users. Config on both firewalls

Symfony2 - FOSUserBundle - Multiple Login Locations

*爱你&永不变心* 提交于 2019-11-30 21:50:25
I'm using the FOSUserBundle and I require the ability to login from 2 different routes(or more). These routes will have different templates and also login to different areas. The only thing that differs between the logins is the permission required. The routes will be something along the lines of site.com/login site.com/admin/login and also possible site.com/ajax_login I've been able to work out how to get different templates to render by ripping out everything but the CSRF token from the FOSUserBundle login.html.twig(that is overriden) then creating routes that render their own login boxes

Overriding FOSUserBundle's templates from inheritance

拟墨画扇 提交于 2019-11-30 20:20:56
问题 As the title suggests I'm trying to customize FOSUserBundle's templates with my own ones. But it doesn't work at all. I tried everything as stated in every posts I found, proofread everything, cleared the cache thousands of times, still not working. Bundle class with getParent : <?php // src/PLL/UserBundle/PLLUserBundle.php namespace PLL\UserBundle; use Symfony\Component\HttpKernel\Bundle\Bundle; class PLLUserBundle extends Bundle { public function getParent() { return 'FOSUserBundle'; } } ?>

FOSUserBundle logout with prefix doesn't work

人走茶凉 提交于 2019-11-30 20:05:55
I am having a very strange problem with symfony2 and the FOSUserBundle. I can logout with /en/logout, but not with /nl/logout or /fr/logout. When I try to logout with nl or fr I get: You must activate the logout in your security firewall configuration. Although I configured it. I can't seem to wrap my head why the /en/logout works and the rest doesn't. This is my code: security.yml security: providers: fos_userbundle: id: fos_user.user_provider.username_email encoders: FOS\UserBundle\Model\UserInterface: sha512 firewalls: main: pattern: ^/ form_login: provider: fos_userbundle csrf_provider:

Symfony impersonation - separate firewalls and separate user providers

爱⌒轻易说出口 提交于 2019-11-30 17:37:50
问题 I have a Symfony application with two firewalls, one for admins and one for normal users. admin: provider: admin # etc main_site: form_login: provider: fos_userbundle csrf_provider: form.csrf_provider I'd like admin users to be able to impersonate normal users. How can I do this, given that they're using separate firewalls and separate user providers? 回答1: There were several things I had to do to get this to work. Context key: As described here, I had to give both firewalls the same context.

Symfony2 - FOSUserBundle - Multiple Login Locations

久未见 提交于 2019-11-30 17:01:39
问题 I'm using the FOSUserBundle and I require the ability to login from 2 different routes(or more). These routes will have different templates and also login to different areas. The only thing that differs between the logins is the permission required. The routes will be something along the lines of site.com/login site.com/admin/login and also possible site.com/ajax_login I've been able to work out how to get different templates to render by ripping out everything but the CSRF token from the