mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-30 02:25:00 +00:00
Apply rector rules: symfony up to 54
This commit is contained in:
@@ -27,7 +27,6 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
|
||||
use Symfony\Component\Validator\Constraints\Callback;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
@@ -40,21 +39,18 @@ final class PasswordController extends AbstractController
|
||||
/**
|
||||
* PasswordController constructor.
|
||||
*/
|
||||
public function __construct(private readonly LoggerInterface $chillLogger, private readonly UserPasswordEncoderInterface $passwordEncoder, private readonly RecoverPasswordHelper $recoverPasswordHelper, private readonly TokenManager $tokenManager, private readonly TranslatorInterface $translator, private readonly EventDispatcherInterface $eventDispatcher, private readonly ChillSecurity $security, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
|
||||
public function __construct(private readonly LoggerInterface $chillLogger, private readonly \Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface $passwordEncoder, private readonly RecoverPasswordHelper $recoverPasswordHelper, private readonly TokenManager $tokenManager, private readonly TranslatorInterface $translator, private readonly EventDispatcherInterface $eventDispatcher, private readonly ChillSecurity $security, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
|
||||
|
||||
/**
|
||||
* @return Response
|
||||
*
|
||||
* @\Symfony\Component\Routing\Annotation\Route(path="/public/{_locale}/password/request-changed", name="password_request_recover_changed")
|
||||
*/
|
||||
#[Route(path: '/public/{_locale}/password/request-changed', name: 'password_request_recover_changed')]
|
||||
public function changeConfirmedAction()
|
||||
{
|
||||
return $this->render('@ChillMain/Password/recover_password_changed.html.twig');
|
||||
}
|
||||
|
||||
/**
|
||||
* @\Symfony\Component\Routing\Annotation\Route(path="/public/{_locale}/password/recover", name="password_recover")
|
||||
*/
|
||||
#[Route(path: '/public/{_locale}/password/recover', name: 'password_recover')]
|
||||
public function recoverAction(Request $request): Response|\Symfony\Component\HttpFoundation\RedirectResponse
|
||||
{
|
||||
if (false === $this->isGranted(PasswordRecoverVoter::ASK_TOKEN)) {
|
||||
@@ -96,7 +92,7 @@ final class PasswordController extends AbstractController
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$password = $form->get('new_password')->getData();
|
||||
$user->setPassword($this->passwordEncoder->encodePassword($user, $password));
|
||||
$user->setPassword($this->passwordEncoder->hashPassword($user, $password));
|
||||
// logging for prod
|
||||
$this
|
||||
->chillLogger
|
||||
@@ -120,9 +116,11 @@ final class PasswordController extends AbstractController
|
||||
/**
|
||||
* @throws \Doctrine\ORM\NoResultException
|
||||
* @throws \Doctrine\ORM\NonUniqueResultException
|
||||
* @throws \Doctrine\ORM\NonUniqueResultException
|
||||
*
|
||||
* @\Symfony\Component\Routing\Annotation\Route(path="/public/{_locale}/password/request-recover", name="password_request_recover")
|
||||
*/
|
||||
#[Route(path: '/public/{_locale}/password/request-recover', name: 'password_request_recover')]
|
||||
public function requestRecoverAction(Request $request): Response|\Symfony\Component\HttpFoundation\RedirectResponse
|
||||
{
|
||||
if (false === $this->isGranted(PasswordRecoverVoter::ASK_TOKEN)) {
|
||||
@@ -193,9 +191,8 @@ final class PasswordController extends AbstractController
|
||||
|
||||
/**
|
||||
* @return Response
|
||||
*
|
||||
* @\Symfony\Component\Routing\Annotation\Route(path="/public/{_locale}/password/request-confirm", name="password_request_recover_confirm")
|
||||
*/
|
||||
#[Route(path: '/public/{_locale}/password/request-confirm', name: 'password_request_recover_confirm')]
|
||||
public function requestRecoverConfirmAction()
|
||||
{
|
||||
return $this->render('@ChillMain/Password/request_recover_password_confirm.html.twig');
|
||||
@@ -203,9 +200,8 @@ final class PasswordController extends AbstractController
|
||||
|
||||
/**
|
||||
* @return Response
|
||||
*
|
||||
* @Route("/{_locale}/my/password", name="change_my_password")
|
||||
*/
|
||||
#[Route(path: '/{_locale}/my/password', name: 'change_my_password')]
|
||||
public function UserPasswordAction(Request $request)
|
||||
{
|
||||
if (!$this->security->isGranted('ROLE_USER')) {
|
||||
@@ -234,7 +230,7 @@ final class PasswordController extends AbstractController
|
||||
]
|
||||
);
|
||||
|
||||
$user->setPassword($this->passwordEncoder->encodePassword($user, $password));
|
||||
$user->setPassword($this->passwordEncoder->hashPassword($user, $password));
|
||||
|
||||
$em = $this->managerRegistry->getManager();
|
||||
$em->flush();
|
||||
|
Reference in New Issue
Block a user