Fixed code style.

This commit is contained in:
Jan Böhmer 2020-08-21 21:36:22 +02:00
parent 2853e471c4
commit d0b1024d80
212 changed files with 495 additions and 1005 deletions

View file

@ -44,7 +44,6 @@ namespace App\EventSubscriber\UserSystem;
use App\Entity\UserSystem\User;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\HttpKernel\Event\RequestEvent;
@ -97,15 +96,15 @@ final class PasswordChangeNeededSubscriber implements EventSubscriberInterface
$user = $this->security->getUser();
$request = $event->getRequest();
if (! $event->isMasterRequest()) {
if (!$event->isMasterRequest()) {
return;
}
if (! $user instanceof User) {
if (!$user instanceof User) {
return;
}
//Abort if we dont need to redirect the user.
if (! $user->isNeedPwChange() && ! static::TFARedirectNeeded($user)) {
if (!$user->isNeedPwChange() && !static::TFARedirectNeeded($user)) {
return;
}
@ -140,15 +139,15 @@ final class PasswordChangeNeededSubscriber implements EventSubscriberInterface
* That is the case if the group of the user enforces 2FA, but the user has neither Google Authenticator nor an
* U2F key setup.
*
* @param User $user The user for which should be checked if it needs to be redirected.
* @param User $user the user for which should be checked if it needs to be redirected
*
* @return bool True if the user needs to be redirected.
* @return bool true if the user needs to be redirected
*/
public static function TFARedirectNeeded(User $user): bool
{
$tfa_enabled = $user->isU2FAuthEnabled() || $user->isGoogleAuthenticatorEnabled();
if (null !== $user->getGroup() && $user->getGroup()->isEnforce2FA() && ! $tfa_enabled) {
if (null !== $user->getGroup() && $user->getGroup()->isEnforce2FA() && !$tfa_enabled) {
return true;
}

View file

@ -51,7 +51,6 @@ use R\U2FTwoFactorBundle\Event\RegisterEvent;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
@ -96,9 +95,9 @@ final class RegisterU2FSubscriber implements EventSubscriberInterface
public function onRegister(RegisterEvent $event): void
{
//Skip adding of U2F key on demo mode
if (! $this->demo_mode) {
if (!$this->demo_mode) {
$user = $event->getUser();
if (! $user instanceof User) {
if (!$user instanceof User) {
throw new \InvalidArgumentException('Only User objects can be registered for U2F!');
}

View file

@ -68,12 +68,12 @@ final class SetUserTimezoneSubscriber implements EventSubscriberInterface
//Check if the user has set a timezone
$user = $this->security->getUser();
if ($user instanceof User && ! empty($user->getTimezone())) {
if ($user instanceof User && !empty($user->getTimezone())) {
$timezone = $user->getTimezone();
}
//Fill with default value if needed
if (null === $timezone && ! empty($this->default_timezone)) {
if (null === $timezone && !empty($this->default_timezone)) {
$timezone = $this->default_timezone;
}