Switch to new authentication system
This commit is contained in:
parent
d277d9c93e
commit
f2eed9d848
3 changed files with 38 additions and 76 deletions
|
@ -7,6 +7,7 @@ use Doctrine\Common\Collections\ArrayCollection;
|
|||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
|
||||
/**
|
||||
|
@ -14,7 +15,7 @@ use Symfony\Component\Security\Core\User\UserInterface;
|
|||
* @ORM\Table(name="`user`")
|
||||
* @UniqueEntity(fields={"email"}, message="There is already an account with this email")
|
||||
*/
|
||||
class User implements UserInterface
|
||||
class User implements UserInterface, PasswordAuthenticatedUserInterface
|
||||
{
|
||||
/**
|
||||
* @ORM\Id
|
||||
|
@ -92,6 +93,14 @@ class User implements UserInterface
|
|||
*
|
||||
* @see UserInterface
|
||||
*/
|
||||
public function getUserIdentifier(): string
|
||||
{
|
||||
return (string) $this->email;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since Symfony 5.3, use getUserIdentifier instead
|
||||
*/
|
||||
public function getUsername(): string
|
||||
{
|
||||
return (string) $this->username;
|
||||
|
@ -117,11 +126,11 @@ class User implements UserInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* @see UserInterface
|
||||
* @see PasswordAuthenticatedUserInterface
|
||||
*/
|
||||
public function getPassword(): string
|
||||
{
|
||||
return (string) $this->password;
|
||||
return $this->password;
|
||||
}
|
||||
|
||||
public function setPassword(string $password): self
|
||||
|
|
Reference in a new issue