Hi,
I'm using Sonata admin, Sonata user, and FOS Bundle.
I
manage to override the UserAdmin entity to show the fields I need when
showing / editing a user, but I'd need to override login form.
Basically, I need the user to login with a username, and a combination of both a password and a PIN code.
I followed this tutorial
http://symfony.com/doc/current/bundles/FOSUserBundle/overriding_forms.html and tried with the registration form as in the example, but no matter what I do, I still have the same original fields.
My Kernel file uses this :
new FOS\UserBundle\FOSUserBundle(),
new Application\FOS\UserBundle\ApplicationFOSUserBundle(),
new Sonata\UserBundle\SonataUserBundle('FOSUserBundle'),
new UserBundle\UserBundle(), //my custom bundle where I define my entity, my UserAdmin...
My custom form, which does not implement getParent() to use my own fields, as specified in the doc:
<?php
namespace UserBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
class RegistrationType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('pinCode');
}
public function getName()
{
return 'app_user_registration';
}
}
The service is declared
<service id="coupons_user.registration.form.type" class="UserBundle\Form\RegistrationFormType">
<tag name="form.type" alias="app_user_registration" />
<argument>%fos_user.model.user.class%</argument>
</service>
The form is declared in FOS config :
registration:
form:
type: app_user_registration
But whatever I try, no changes... I know I'm doing something wrong.. but where ?
Will it be the same process for the login form ? How
can I override this form to display my fields ? And then, what would be
the best way to override controllers to have it check that the triplet
username/password/PIN is correct ?
Thanks in advance !!