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