Must have forgotten a comma somewhere or something but it seems to work now.
Symfony/app/config/config.yml
...unchanged other stuff
services:
acme.legacy_encoder:
class: Acme\DemoBundle\Entity\User
...unchanged other stuff
Symfony/src/Acme/DemoBundle/Entity/User.php
namespace Acme\DemoBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Core\Encoder\PasswordEncoderInterface;
/**
* Acme\DemoBundle\Entity\User
*
* @ORM\Table(name="jos_users")
* @ORM\Entity
*/
class User implements UserInterface, \Serializable,PasswordEncoderInterface
{
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="string", length=25, unique=true)
*/
private $username;
/**
* @ORM\Column(type="string", length=64)
*/
private $password;
/**
* @ORM\Column(type="string", length=60, unique=true)
*/
private $email;
/**
* @ORM\Column(name="block", type="integer")
*/
private $isActive;
/**
* @ORM\Column(type="string", length=32)
*/
private $salt;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set username
*
* @param string $username
* @return User
*/
public function setUsername($username)
{
$this->username = $username;
return $this;
}
/**
* Get username
*
* @return string
*/
public function getUsername()
{
return $this->username;
}
/**
* Set password
*
* @param string $password
* @return User
*/
public function setPassword($password)
{
$this->password = $password;
return $this;
}
/**
* Get password
*
* @return string
*/
public function getPassword()
{
$parts = explode( ':', $this->password );
return $parts[0];
}
/**
* Set email
*
* @param string $email
* @return User
*/
public function setEmail($email)
{
$this->email = $email;
return $this;
}
/**
* Get email
*
* @return string
*/
public function getEmail()
{
return $this->email;
}
/**
* Set isActive
*
* @param boolean $isActive
* @return User
*/
public function setIsActive($isActive)
{
$this->isActive = $isActive?1:0;
return $this;
}
/**
* Get isActive
*
* @return boolean
*/
public function getIsActive()
{
return !$this->block;
}
public function __construct()
{
$this->isActive = 1;
// may not be needed, see section on salt below
//$this->salt = md5(uniqid(null, true));
}
/**
* @inheritDoc
*/
public function getSalt()
{
return $this->salt;
}
/**
* @inheritDoc
*/
public function getRoles()
{
return array('ROLE_USER');
}
/**
* @inheritDoc
*/
public function eraseCredentials()
{
}
/**
* @see \Serializable::serialize()
*/
public function serialize()
{
return serialize(array(
$this->id,
$this->username,
$this->password,
// see section on salt below
// $this->salt,
));
}
/**
* @see \Serializable::unserialize()
*/
public function unserialize($serialized)
{
list (
$this->id,
$this->username,
$this->password,
// see section on salt below
// $this->salt
) = unserialize($serialized);
}
public function encodePassword($raw, $salt){
return "hello world";
}
public function isPasswordValid($encoded, $raw, $salt){
return true;
}
}
Since isPasswordValid always returns true it now logs me in on any existing account. I can now continue with the tutorial and try to implement group