Skip to content

[FEATURE] Add AfterUserConfirmEvent #679

Description

@dkd-hauser

We had the requirement to implement an additional supervisor confirmation after the user has confirmed themselves. Only then are further steps taken, such as admin confirmation.

Therefore, we needed a new event AfterUserConfirmation.

add Classes/Event/AfterUserConfirmEvent.php

<?php

declare(strict_types=1);

namespace In2code\Femanager\Event;

use In2code\Femanager\Domain\Model\User;

/**
 * Event that is dispatched after a frontend user has successfully confirmed
 */
final class AfterUserConfirmEvent
{
    public function __construct(
        private readonly ?User $user,
        private readonly string $hash,
        private readonly string $status
    ) {
    }

    public function getUser(): ?User
    {
        return $this->user;
    }

    public function getHash(): string
    {
        return $this->hash;
    }

    public function getStatus(): string
    {
        return $this->status;
    }
}

to make that work with enabled confirm user confirmation feature (confirmUserConfirmation = 1) the function statusUserConfirmation in NewController.php has to be extended:

Index: Classes/Controller/NewController.php
===================================================================
--- /Classes/Controller/NewController.php
+++ /Classes/Controller/NewController.php
@@ -12,6 +12,7 @@
 use In2code\Femanager\Domain\Validator\ServersideValidator;
 use In2code\Femanager\Event\BeforeUserConfirmEvent;
 use In2code\Femanager\Event\BeforeUserCreateEvent;
+use In2code\Femanager\Event\AfterUserConfirmEvent;
 use In2code\Femanager\Event\CreateConfirmationRequestEvent;
 use In2code\Femanager\Event\UserWasConfirmedByAdminEvent;
 use In2code\Femanager\Utility\ConfigurationUtility;
@@ -262,6 +262,7 @@
             $this->userRepository->update($user);
             $this->persistenceManager->persistAll();
             $this->logUtility->log(Log::STATUS_REGISTRATIONCONFIRMEDUSER, $user);
+            $this->eventDispatcher->dispatch(new AfterUserConfirmEvent($user, $hash, $status));
 
             if ($this->isAdminConfirmationMissing($user)) {
                 $this->createAdminConfirmationRequest($user);

It would be nice if this feature were adopted and also backported to v8.3.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions