Rewrite login_check functionality in Symfony

10,777

You can either use built in AdvancedUserInterface (recommended) http://symfony.com/doc/current/cookbook/security/entity_provider.html#forbid-non-active-users or create custom Entity Provider http://symfony.com/doc/current/cookbook/security/entity_provider.html#authenticating-someone-with-a-custom-entity-provider

Share:
10,777
Roel Veldhuizen
Author by

Roel Veldhuizen

@roelveldhuizen

Updated on June 04, 2022

Comments

  • Roel Veldhuizen
    Roel Veldhuizen almost 2 years

    How do I add an extra check to the default Symfony login_check? Most documentation is about how to customize the login form, but in this case I only want to add an extra check whether a user has the the status active.

    I assume that I have to redirect the route pattern: /login_check to my own security check, but what should this function look like? It seems I can't find any documentation on that.

  • Roel Veldhuizen
    Roel Veldhuizen about 12 years
    thanks this indeed seems a solution. The thing is if i implement the AdvanceUserInterface i get an error on the UserInterface::equals implementation. Fatal error: Declaration of Paston\VerBundle\Entity\User::equals() must be compatible with that of Symfony\Component\Security\Core\User\UserInterface::equals() in C:\xampp\htdocs\symfony\src\Paston\VerBundle\Entity\User.php on line 14"
  • Roel Veldhuizen
    Roel Veldhuizen about 12 years
    fixed! Had to import both UserInterface as AdvancedUserInterface