Symfony 2 authentication with (doctrine) Entity Symfony 2 authentication with (doctrine) Entity symfony symfony

Symfony 2 authentication with (doctrine) Entity


Finally somebody helped me.The issue is that I wasn't using any salt to create the password, and in the getSalt function of the User class I was returning the ID.

The password is generated like this (in the controller):

$factory = $this->container->get('security.encoder_factory');$encoder = $factory->getEncoder($user);$pwd = $encoder->encodePassword('your_random_password', $user->getSalt());$user->setPassword($pwd);