mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-23 08:03:49 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -17,8 +17,6 @@ use Chill\MainBundle\Security\PasswordRecover\PasswordRecoverEvent;
|
||||
use Chill\MainBundle\Security\PasswordRecover\PasswordRecoverVoter;
|
||||
use Chill\MainBundle\Security\PasswordRecover\RecoverPasswordHelper;
|
||||
use Chill\MainBundle\Security\PasswordRecover\TokenManager;
|
||||
use DateInterval;
|
||||
use DateTimeImmutable;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
@@ -88,6 +86,7 @@ class PasswordController extends AbstractController
|
||||
|
||||
/**
|
||||
* @return Response
|
||||
*
|
||||
* @\Symfony\Component\Routing\Annotation\Route(path="/public/{_locale}/password/request-changed", name="password_request_recover_changed")
|
||||
*/
|
||||
public function changeConfirmedAction()
|
||||
@@ -96,15 +95,14 @@ class PasswordController extends AbstractController
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Response|\Symfony\Component\HttpFoundation\RedirectResponse
|
||||
* @\Symfony\Component\Routing\Annotation\Route(path="/public/{_locale}/password/recover", name="password_recover")
|
||||
*/
|
||||
public function recoverAction(Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
|
||||
public function recoverAction(Request $request): Response|\Symfony\Component\HttpFoundation\RedirectResponse
|
||||
{
|
||||
if (false === $this->isGranted(PasswordRecoverVoter::ASK_TOKEN)) {
|
||||
return new Response($this->translator->trans('You are not allowed '
|
||||
. 'to try to recover password, due to mitigating possible '
|
||||
. 'attack. Try to contact your system administrator'), Response::HTTP_FORBIDDEN);
|
||||
.'to try to recover password, due to mitigating possible '
|
||||
.'attack. Try to contact your system administrator'), Response::HTTP_FORBIDDEN);
|
||||
}
|
||||
|
||||
$query = $request->query;
|
||||
@@ -165,15 +163,14 @@ class PasswordController extends AbstractController
|
||||
* @throws \Doctrine\ORM\NoResultException
|
||||
* @throws \Doctrine\ORM\NonUniqueResultException
|
||||
*
|
||||
* @return Response|\Symfony\Component\HttpFoundation\RedirectResponse
|
||||
* @\Symfony\Component\Routing\Annotation\Route(path="/public/{_locale}/password/request-recover", name="password_request_recover")
|
||||
*/
|
||||
public function requestRecoverAction(Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
|
||||
public function requestRecoverAction(Request $request): Response|\Symfony\Component\HttpFoundation\RedirectResponse
|
||||
{
|
||||
if (false === $this->isGranted(PasswordRecoverVoter::ASK_TOKEN)) {
|
||||
return new Response($this->translator->trans('You are not allowed '
|
||||
. 'to try to recover password, due to mitigating possible '
|
||||
. 'attack. Try to contact your system administrator'), Response::HTTP_FORBIDDEN);
|
||||
.'to try to recover password, due to mitigating possible '
|
||||
.'attack. Try to contact your system administrator'), Response::HTTP_FORBIDDEN);
|
||||
}
|
||||
|
||||
$form = $this->requestRecoverForm();
|
||||
@@ -194,17 +191,17 @@ class PasswordController extends AbstractController
|
||||
|
||||
if (empty($user->getEmail())) {
|
||||
$this->addFlash('error', $this->translator->trans('This account does not have an email address. '
|
||||
. 'Please ask your administrator to renew your password.'));
|
||||
.'Please ask your administrator to renew your password.'));
|
||||
} else {
|
||||
if (false === $this->isGranted(PasswordRecoverVoter::ASK_TOKEN, $user)) {
|
||||
return new Response($this->translator->trans('You are not allowed '
|
||||
. 'to try to recover password, due to mitigating possible '
|
||||
. 'attack. Try to contact your system administrator'), Response::HTTP_FORBIDDEN);
|
||||
.'to try to recover password, due to mitigating possible '
|
||||
.'attack. Try to contact your system administrator'), Response::HTTP_FORBIDDEN);
|
||||
}
|
||||
|
||||
$this->recoverPasswordHelper->sendRecoverEmail(
|
||||
$user,
|
||||
(new DateTimeImmutable('now'))->add(new DateInterval('PT30M'))
|
||||
(new \DateTimeImmutable('now'))->add(new \DateInterval('PT30M'))
|
||||
);
|
||||
|
||||
// logging for prod
|
||||
@@ -238,6 +235,7 @@ class PasswordController extends AbstractController
|
||||
|
||||
/**
|
||||
* @return Response
|
||||
*
|
||||
* @\Symfony\Component\Routing\Annotation\Route(path="/public/{_locale}/password/request-confirm", name="password_request_recover_confirm")
|
||||
*/
|
||||
public function requestRecoverConfirmAction()
|
||||
@@ -247,6 +245,7 @@ class PasswordController extends AbstractController
|
||||
|
||||
/**
|
||||
* @return Response
|
||||
*
|
||||
* @Route("/{_locale}/my/password", name="change_my_password")
|
||||
*/
|
||||
public function UserPasswordAction(Request $request)
|
||||
@@ -310,7 +309,7 @@ class PasswordController extends AbstractController
|
||||
->orWhere($qb->expr()->eq('u.emailCanonical', 'UNACCENT(LOWER(:pattern))'))
|
||||
->setParameter('pattern', $pattern);
|
||||
|
||||
if ((int) $qb->getQuery()->getSingleScalarResult() !== 1) {
|
||||
if (1 !== (int) $qb->getQuery()->getSingleScalarResult()) {
|
||||
$context->addViolation('This username or email does not exists');
|
||||
}
|
||||
},
|
||||
|
Reference in New Issue
Block a user