backports murph-skeleton
This commit is contained in:
parent
7624648e23
commit
16d9531661
|
@ -1,10 +1,10 @@
|
|||
{
|
||||
"type": "project",
|
||||
"license": "proprietary",
|
||||
"minimum-stability": "dev",
|
||||
"minimum-stability": "stable",
|
||||
"prefer-stable": true,
|
||||
"require": {
|
||||
"php": ">=7.2.5",
|
||||
"php": ">=8.0.0",
|
||||
"ext-ctype": "*",
|
||||
"ext-iconv": "*",
|
||||
"beberlei/doctrineextensions": "^1.3",
|
||||
|
@ -53,7 +53,7 @@
|
|||
"symfony/string": "5.4.*",
|
||||
"symfony/swiftmailer-bundle": "^3.5",
|
||||
"symfony/translation": "5.4.*",
|
||||
"symfony/twig-bundle": "^5.4",
|
||||
"symfony/twig-bundle": "^5.2",
|
||||
"symfony/validator": "5.4.*",
|
||||
"symfony/web-link": "5.4.*",
|
||||
"symfony/webpack-encore-bundle": "^1.11",
|
||||
|
|
|
@ -7,13 +7,14 @@ use App\Core\Entity\EntityInterface;
|
|||
use App\Repository\UserRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Scheb\TwoFactorBundle\Model\Google\TwoFactorInterface;
|
||||
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
|
||||
/**
|
||||
* @ORM\Entity(repositoryClass=UserRepository::class)
|
||||
* @ORM\HasLifecycleCallbacks()
|
||||
*/
|
||||
class User implements UserInterface, TwoFactorInterface, EntityInterface
|
||||
class User implements PasswordAuthenticatedUserInterface, UserInterface, TwoFactorInterface, EntityInterface
|
||||
{
|
||||
use Timestampable;
|
||||
/**
|
||||
|
@ -83,6 +84,14 @@ class User implements UserInterface, TwoFactorInterface, EntityInterface
|
|||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see UserInterface
|
||||
*/
|
||||
public function getUserIdentifier(): string
|
||||
{
|
||||
return $this->getUsername();
|
||||
}
|
||||
|
||||
public function getEmail(): ?string
|
||||
{
|
||||
return $this->email;
|
||||
|
@ -95,11 +104,6 @@ class User implements UserInterface, TwoFactorInterface, EntityInterface
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* A visual identifier that represents this user.
|
||||
*
|
||||
* @see UserInterface
|
||||
*/
|
||||
public function getUsername(): string
|
||||
{
|
||||
return (string) $this->email;
|
||||
|
@ -130,9 +134,6 @@ class User implements UserInterface, TwoFactorInterface, EntityInterface
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see UserInterface
|
||||
*/
|
||||
public function getPassword(): string
|
||||
{
|
||||
return (string) $this->password;
|
||||
|
@ -145,20 +146,11 @@ class User implements UserInterface, TwoFactorInterface, EntityInterface
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returning a salt is only needed, if you are not using a modern
|
||||
* hashing algorithm (e.g. bcrypt or sodium) in your security.yaml.
|
||||
*
|
||||
* @see UserInterface
|
||||
*/
|
||||
public function getSalt(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see UserInterface
|
||||
*/
|
||||
public function eraseCredentials()
|
||||
{
|
||||
// If you store any temporary, sensitive data on the user, clear it here
|
||||
|
|
|
@ -8,6 +8,7 @@ use Doctrine\Persistence\ManagerRegistry;
|
|||
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
|
||||
use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
|
||||
|
||||
class UserRepository extends ServiceEntityRepository implements PasswordUpgraderInterface
|
||||
{
|
||||
|
@ -16,7 +17,7 @@ class UserRepository extends ServiceEntityRepository implements PasswordUpgrader
|
|||
parent::__construct($registry, User::class);
|
||||
}
|
||||
|
||||
public function upgradePassword(UserInterface $user, string $newEncodedPassword): void
|
||||
public function upgradePassword(PasswordAuthenticatedUserInterface $user, string $newEncodedPassword): void
|
||||
{
|
||||
if (!$user instanceof User) {
|
||||
throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', \get_class($user)));
|
||||
|
|
Loading…
Reference in a new issue