fosuserbundle

FosUserBundle Different Login Pages

ⅰ亾dé卋堺 提交于 2019-12-08 08:17:31
问题 I'v searching for hours and i did not find really how can we override login template for user and the admin side. I'v created an admin firewall in security.yml firewalls: admin: pattern: /admin(.*) form_login: provider: fos_userbundle csrf_provider: form.csrf_provider login_path: /admin/login check_path: /admin/login_check default_target_path: /admin logout: path: /admin/logout target: / anonymous: true access_control: - { path: ^/admin/login$, roles: IS_AUTHENTICATED_ANONYMOUSLY } - { path:

How to merge login and register form in one template on FOSUserBundle

你离开我真会死。 提交于 2019-12-08 07:22:55
问题 I am using the FOSUserBundle in my Symfony application, I have the login and register forms in a separate template. I want both in one template to display them next to each other. plz help me save my day !! 回答1: 1 You need to have a first controller with a loginAction that renders a login.html.twig template. Let's assume this controller is AcmeUserBundle:Security:login . 2 You need to have a second controller with a registerAction that renders a register.html.twig template. Let's assume this

Symfony 2 Login on main domain only

半腔热情 提交于 2019-12-08 06:17:06
问题 I am working on a application using multiple subdomains : .domain.com admin.domain.com {username}.domain.com and so on. I am using the FOSUserBundle to handle my users and I am wondering how I could force users to login only on the main .domain.com. For example, when a user is trying to access the administration, redirect him to http://domain.com/login instead of http://admin.domain.com/login. I was thinking about a LoginListener somewhere, but I have no idea where I could create it and how

Extending registration FOSUserBundle form looking for improper methods

流过昼夜 提交于 2019-12-08 05:48:21
问题 I am using the FOSUserBundle and I extended the registration form to input the name of a company when registering a new user. Company is a separate Entity. I created all required methods for the relation handling. /** * User entity */ class User { // ... addCompany() { /* ... */ } removeCompany() { /* ... */ } getCompanies() { /* ... */ } } I followed the Symfony guide to embed a Single Object to a form: class RegistrationFormType extends \FOS\UserBundle\Form\Type\RegistrationFormType {

FOSUserBundle extend propel User

拜拜、爱过 提交于 2019-12-08 05:45:24
问题 I'm using FOSUserBundle and Propel in a Symfony 2.2 project. I'm trying to extend the User class and add a new method to it like so: namespace Acme\UserBundle\Model; use FOS\UserBundle\Propel\User as BaseUser; class User extends BaseUser { protected $id; public function __construct() { parent::__construct(); // your own logic } public function hasPermission($topic) { // TODO check if $topic has permission return TRUE; } } The problem is that when calling $this->getUser() in a controller, the

'FOS\UserBundle\FOSUserBundle' not found

為{幸葍}努か 提交于 2019-12-08 04:30:42
问题 in symfony 2.5 I want use FOSUserBundle, I do any steps in github and when try to update schema see this error Fatal error: Class 'FOS\UserBundle\FOSUserBundle' not found in /opt/lampp/htdocs/symfonyTest/app/AppKernel.php on line 23 FOSUserBundle is in vendor/friendsofsymfony/user-bundle/FOS this is my AppKernel $bundles = array( //... other bundles new FOS\UserBundle\FOSUserBundle(), ); and my app/config/config.yml fos_user: db_driver: orm # other valid values are 'mongodb', 'couchdb' and

Novalidate isn't working on FOS user registration form

不问归期 提交于 2019-12-08 04:17:57
问题 I overwrote the FOS UserBundle registration form and added the default options: 'attr'=> array('novalidate'=>'novalidate') as answered here (which seems like the right way to go) but for some strange reason the novalidated is added to a div right after the form instead of the form. FormType: <?php namespace AppBundle\Form\Type; use Symfony\Component\Form\FormBuilderInterface; use FOS\UserBundle\Form\Type\RegistrationFormType as BaseType; use Symfony\Component\OptionsResolver

FOSUserBundle: User doesn't get roles of group

我只是一个虾纸丫 提交于 2019-12-08 04:03:11
问题 I am using symfony 2.5 and trying to check if a user has a specific role. The tables are set up correctly in the database and the data is correct inserted: In the database exists a user test@example.com with a mapped group admin which has defined the roles a:1:{i:0;s:10:"ROLE_ADMIN";} I don't know why the roles aren't read correct. The debug-toolbar tells me, that i am only authenticated as ROLE_USER . Code: $securityContext = $this->container->get('security.context'); $securityContext-

FOSUserBundle extend propel User

天大地大妈咪最大 提交于 2019-12-08 00:25:29
I'm using FOSUserBundle and Propel in a Symfony 2.2 project. I'm trying to extend the User class and add a new method to it like so: namespace Acme\UserBundle\Model; use FOS\UserBundle\Propel\User as BaseUser; class User extends BaseUser { protected $id; public function __construct() { parent::__construct(); // your own logic } public function hasPermission($topic) { // TODO check if $topic has permission return TRUE; } } The problem is that when calling $this->getUser() in a controller, the class of the object returned is FOS\UserBundle\Propel\User , so hasPermission() is undefined. I tried

Symfony & FOSUserBundle. Customize validation errors on register template

為{幸葍}努か 提交于 2019-12-08 00:01:57
问题 I was trying to solve my problem: I'm not able to find where the validation errors of register_content.html.twig are defined. I need to know how to show that errors as I would like. Nowadays my Register is looks like: As you can see, there is a ugly validation error. I want to change the tags <div> <ul><li> Las dos contraseñas no coinciden. </li></ul> </div> predefined somewhere, by another. I have overridden the view register_content.html.twig and I can to show that validation errors but not