fosuserbundle

Adding customised validation rules to SonataUserBundle

♀尐吖头ヾ 提交于 2019-12-04 02:32:29
I have installed SonataUserBundle according to the docs and it all works fine. Except that I cannot add custom validation rules. My understanding is that the new rules should be added to a new Validation Group and then config.yml is updated to tell SonataUserBundle (or FosUserBundle) to add the new rules to the validation sequence. I have tried this, in various ways, but the new rules just don't seem to be picked up at all... Here's the configuration I'm using... (For the sake of this example, I'm just trying to adding a NotNull constraint to a new foo field. In reality I would like to see

How to definitely disable registration in FOSUserBundle

南楼画角 提交于 2019-12-03 23:18:52
In my project, I allow only one user to manage the content of the website. This user will be added using the command line at first. Now, I want to get the registration action inaccessible and I don't know how? Till now, I just put the ROLE_ADMIN in the access control for the route register to avoid that visitors can go throw it. Any tips? There are many ways to solve this issue. You can simply remove fos_user_registration_register route from routing.yml. Or use more complicated solution: set up event listener to FOS\UserBundle\FOSUserEvents::REGISTRATION_INITIALIZE event and redirect user to

Symfony 2.7 / 3 - Doctrine: You have requested a non-existent service “fos_user.doctrine_registry”

感情迁移 提交于 2019-12-03 22:10:09
Doing a composer update today suddenly getting the following error: [Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException] You have requested a non-existent service "fos_user.doctrine_registry". when composer is executing the cache:clear --no-warmup command. Search found an answer related to converting from doctrine to MongoDB but the solutions are not working for me. I am using Doctrine. I've tried Fosuserbundle dev-master, dev-master@dev, 2.0.0-alpha1 and 2.0.0-alpha3. Any other suggestions? Composer update was working fine a couple of days ago. Issue created here: https:

FOSUserBundle : Overriding a Twig template : adding HTML elements

*爱你&永不变心* 提交于 2019-12-03 21:28:53
I'm using FOSUserBundle , and I want to add a few HTML elements to the registration form. Actually, I did and I can see the added properties to the User class in my form. The issue is that I want those fields (first name, last name, date of birth, etc..) to get the look and feel of my CSS template (bootstrap). I succeeded to do that for the login page by overriding it, since the HTML are explicitly declared. I want to do the same for the register page, however it seems confused to me, because here's the content of : register.html.twig {% extends "FOSUserBundle::layout.html.twig" %} {% block

FOS user bundle authentication

戏子无情 提交于 2019-12-03 21:23:26
问题 How FOS User Bundle authenticates the user by this service container? $this->container->get('security.context')->getToken()->getUser(); I want to manipulate the authentication process. Where should I look in the bundle? 回答1: Actually FOSUserBundle doesn't do authentication. It actually provides a db user provider. Authentication part is done by Symfony2's internal form_login authentication provider. If you want to create custom authentication provider check this cookbook entry. 来源: https:/

The good way to persist a FOSUser entity in cascade

前提是你 提交于 2019-12-03 21:12:38
I want to persist a User entity extends FOSUserBundle entity but an error occured : SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'username_canonical' cannot be null How can I overload the persist function of my User entity to give the informations it needs ? My User entity : class User extends BaseUser { /** * @var integer $id * * @ORM\Column(name="id", type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") */ protected $id; /** * * @ORM\OneToOne(targetEntity="MyApp\MainBundle\Entity\Project") */ private $project; ... } My Project entity: class Structure { /** * @var

Symfony2: How to build multiple registration forms with FOSUserBundle

自作多情 提交于 2019-12-03 19:36:38
问题 I'm absolutely new to Symfony2 but already in love with this framework. I'm having a project that requires to have 3 different user types. One will be super admin, other two will be a regular users but with different profile layouts. Different layouts for profile means registration form for those two user types must have different form fields and different layouts in the application after registration. I think I've got the idea (don't know if that will be OK later) how to manage users after

Edit user profile using FOS User Bundle

流过昼夜 提交于 2019-12-03 17:08:48
I'm using symfony 2 with FOSUserBundle, the problem is when adding a user the current user profile logged in will be replaced by the currently added user, then when I tried to edit other user profile, the only editable would be the currently logged in user, is there something wrong with the inherited function from FOSUserBundle? I want that when adding a user, the currently logged in user would not be change with what is being added, and also when I edit another user profile, the user account that I'm trying to edit would be edited, not the currently added user account. Here are my codes from

Doctrine doesn't map fields from FOSUserBundle User class

独自空忆成欢 提交于 2019-12-03 16:52:27
I am using Symfony 2.1 RC1 and the FOSUserbundle on a Windows server running PHP 5.3.13. I have followed the instructions here but Doctrine doesn't create fields in the database for the properties inherited from the base FOS User class (only the fields from my class). Trying to login using the FOS login form produces the error: Unrecognized field: usernameCanonical I have the following Doctrine configuration: # Doctrine Configuration doctrine: dbal: driver: %database_driver% host: %database_host% port: %database_port% dbname: %database_name% user: %database_user% password: %database_password%

Override FOSUserBundle routes Symfony2

浪尽此生 提交于 2019-12-03 16:38:09
I would like to override some routes from FOSUserBundle MyBundle/Resources/config/routing/security.yml fos_user_security_login: path: /{_locale}/login defaults: { _controller: FOSUserBundle:Security:login } requirements: _locale: %locales% fos_user_security_check: path: /login_check defaults: { _controller: FOSUserBundle:Security:check } requirements: _locale: %locales% fos_user_security_logout: path: /{_locale}/logout defaults: { _controller: FOSUserBundle:Security:logout } requirements: _locale: %locales% But it does not works, route are not found MyBundle/Resources/config/routing/security