Log security related events like password reset, 2FA method added, etc.

This commit is contained in:
Jan Böhmer 2020-04-03 18:27:47 +02:00
parent 1b21bf5ddd
commit 470cd2af9e
13 changed files with 485 additions and 8 deletions

View file

@ -44,6 +44,8 @@ namespace App\Controller;
use App\Entity\Attachments\UserAttachment;
use App\Entity\UserSystem\User;
use App\Events\SecurityEvent;
use App\Events\SecurityEvents;
use App\Form\Permissions\PermissionsType;
use App\Form\UserAdminForm;
use App\Services\EntityExporter;
@ -52,6 +54,7 @@ use App\Services\StructuralElementRecursionHelper;
use Doctrine\ORM\EntityManagerInterface;
use InvalidArgumentException;
use Symfony\Component\Asset\Packages;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
@ -97,6 +100,9 @@ class UserController extends AdminPages\BaseAdminController
$entity->invalidateTrustedDeviceTokens();
$em->flush();
$event = new SecurityEvent($entity);
$this->eventDispatcher->dispatch($event, SecurityEvents::TFA_ADMIN_RESET);
$this->addFlash('success', 'user.edit.reset_success');
} else {
$this->addFlash('danger', 'csfr_invalid');