mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-27 12:18:54 +02:00
Applied rector with PHP8.1 migration rules
This commit is contained in:
parent
dc6a67c2f0
commit
7ee01d9a05
303 changed files with 1228 additions and 3465 deletions
|
@ -35,21 +35,13 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
|||
|
||||
class PasswordResetManager
|
||||
{
|
||||
protected MailerInterface $mailer;
|
||||
protected EntityManagerInterface $em;
|
||||
protected PasswordHasherInterface $passwordEncoder;
|
||||
protected TranslatorInterface $translator;
|
||||
protected UserPasswordHasherInterface $userPasswordEncoder;
|
||||
|
||||
public function __construct(MailerInterface $mailer, EntityManagerInterface $em,
|
||||
TranslatorInterface $translator, UserPasswordHasherInterface $userPasswordEncoder,
|
||||
public function __construct(protected MailerInterface $mailer, protected EntityManagerInterface $em,
|
||||
protected TranslatorInterface $translator, protected UserPasswordHasherInterface $userPasswordEncoder,
|
||||
PasswordHasherFactoryInterface $encoderFactory)
|
||||
{
|
||||
$this->em = $em;
|
||||
$this->mailer = $mailer;
|
||||
$this->passwordEncoder = $encoderFactory->getPasswordHasher(User::class);
|
||||
$this->translator = $translator;
|
||||
$this->userPasswordEncoder = $userPasswordEncoder;
|
||||
}
|
||||
|
||||
public function request(string $name_or_email): void
|
||||
|
@ -59,7 +51,7 @@ class PasswordResetManager
|
|||
//Try to find a user by the given string
|
||||
$user = $repo->findByEmailOrName($name_or_email);
|
||||
//Do nothing if no user was found
|
||||
if (null === $user) {
|
||||
if (!$user instanceof \App\Entity\UserSystem\User) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -109,7 +101,7 @@ class PasswordResetManager
|
|||
$user = $repo->findOneBy(['name' => $username]);
|
||||
|
||||
//If no user matching the name, show an error message
|
||||
if (null === $user) {
|
||||
if (!$user instanceof \App\Entity\UserSystem\User) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue