Sends an email to the user to activate his account.

@param FormEvent $event
504107
public function sendConfirmationEmail(FormEvent $event)
    {
        /** @var UserInterface $user */
        $user = $event->getForm()->getData();

        $user->setEnabled(false);
        if (null === $user->getConfirmationToken()) {
            $user->setConfirmationToken($this->generateToken());
        }

        $this->mailer->sendConfirmationEmailMessage($user);

        $this->session->set('silex_user_confirmation_email', $user->getEmail());

        $event->setResponse(new RedirectResponse($this->router->generate('silex_user.registration_check_email')));
    }
694086
public function createForm(FormEvent $event): void
    {
        $admin = $event->getAdmin();
        $action = $admin->getAction();
        $configuration = $action->getConfiguration();

        if (!$configuration->get('use_form')) {
            return;
        }
        $entity = null;

        if (LAGAdminBundle::LOAD_STRATEGY_UNIQUE === $configuration->get('load_strategy')) {
            if (!$admin->getEntities()->isEmpty()) {
                $entity = $admin->getEntities()->first();
            }
        }

        if ('create' === $action->getName() || 'edit' === $action->getName()) {
            $form = $this->adminFormFactory->createEntityForm($admin, $event->getRequest(), $entity);
            $event->addForm($form, 'entity');
        }

        if ('delete' === $action->getName()) {
            $form = $this->adminFormFactory->createDeleteForm($action, $event->getRequest(), $entity);
            $event->addForm($form, 'delete');
        }
    }
156515
public function onPasswordResettingSuccess(FormEvent $event)
    {
        $url = $this->router->generate('campaignchain_core_homepage');

        $event->setResponse(new RedirectResponse($url));
    }
845532
public function onModelAfterSave(Event $event)
    {
        /** @var User|bool $user */
        $user = $event->getData('user');

        if ($user instanceof EntityInterface) {
            if ($user->isNew() && Filter::bool($user->get('notify'))) {
                $this->_getMailer($user)->sendCreateMessage();
            }
        }
    }
271110
public function onPreSubmit(FormEvent $event)
    {
        $contentInfo = null;
        $contentLanguages = [];
        $form = $event->getForm();
        $data = $event->getData();

        if (isset($data['location'])) {
            try {
                $location = $this->locationService->loadLocation($data['location']);
            } catch (NotFoundException $e) {
                $location = null;
            }

            if (null !== $location) {
                $contentInfo = $location->getContentInfo();
                $versionInfo = $this->contentService->loadVersionInfo($contentInfo);
                $contentLanguages = $versionInfo->languageCodes;
            }
        }

        $this->addLanguageFields($form, $contentLanguages, $contentInfo);
    }
193012
public function preSetData(FormEvent $event)
    {
        $form = $event->getForm();

        foreach ($form as $name => $child) {
            $form->remove($name);
        }
    }
733191
public function afterRegister(Event $event)
    {
        if ($event->subject->success) {
            $this->_setUser($event->subject->entity->toArray());
            $this->_setJwt($event->subject->entity->id);
            $this->_sendToken($event, 'register');
        }
    }
743295
public function authorizeRequest(Event $event)
    {
        /* @var \Guzzle\Service\Command\CommandInterface $command */
        $command = $event['command'];

        $request = $command->getRequest();
        $request->setAuth($this->apiKey);
    }
732391
public function onUserActivationPost(UserActivationEvent $e) 
    {
        $password = $e->getParam('password');
        $email = $e->getParam('to');
        $siteUrl = $e->getParam('siteurl');
        $loginUri = $this->getModuleOptions()->getLoginUri();

        // something got really wrong if we get here...
        if(null === $email || null === $password) { 
        	return;
        }
        
        $transport = $this->getServiceLocator()->get('mailer.mail.transport.smtp');
        $message = $this->getServiceLocator()->get('mailer.mail.message.useractivation');
        $message->configure(array(
            'to' => $email,
            'siteurl' => $siteUrl,
            'loginurl' => $siteUrl . $loginUri, 
            'password' => $password,
        	'cdnurl' => $this->getModuleOptions()->getCdnUrl(),
            'siteName' => $this->getModuleOptions()->getSiteName()
        ));
        $transport->send($message);
    }
265784
public function sendActivationEmailToClient($obj, array $input) {
    $mailer = App::make('palmamailer');
    // if i activate a deactivated user
    if (isset($input["activated"]) && $input["activated"] && (!$obj->activated)) {
      $mailer->sendTo($obj->email, ["email" => $obj->email],
                      "You are activated on " .
                      Config::get('authentication::app_name'), "authentication::mail.registration-activated-client");
    }
  }
771056
public function preAdd(Event $e)
    {
        $form = $e->getParam('form');
        /* @var $inputFilter \UthandoUser\InputFilter\UserInputFilter */
        $inputFilter = $form->getInputFilter();
        $inputFilter->addEmailNoRecordExists();
    }
1321695
public function onPreSetData(FormEvent $event)
    {
        if (!$event->getData() || !$event->getForm()->getConfig()->getOption('removable')) {
            return;
        }

        $event->getForm()->add('remove', 'checkbox', array(
            'label' => $this->options['remove_label']
        ));
    }
1186628
public function setRedirect(FormEvent $event)
    {
        $targetPath = $this->getTargetPath($event->getRequest());

        if ($targetPath) {
            $event->setResponse(new RedirectResponse($targetPath));

            return;
        }

        $this->setRedirecToLogin($event);
    }
1105328
public function onFormSuccess(FormEvent $event)
    {
        $form = $event->getForm();

        $result = $this->createResult($form);

        if ($form->getStoreResults()) {
            $this->storeResult($form, $result);
        }

        if ($form->getSendMail()) {
            $this->sendMail($form, $result);
        }

        $successUrl = $form->getSuccessUrl();

        if ($successUrl != null) {
            $redirectResponse = new RedirectResponse($successUrl);
            $redirectResponse->send();
        }
    }
592905
public function register(FormRequestRegister $request)
    {
        $user = $this->create($request->all());

        event(new Registered($user));

        return redirect()
            ->back()
            ->with('status', __('Your account has been created, check your email for the verification link.'));
    }
1002604
public function sendNotificationEmail(OrderEvent $event)
    {
        $this->mailer->sendEmailToShopManagers(
            'order_notification',
            [
                'order_id' => $event->getOrder()->getId(),
                'order_ref' => $event->getOrder()->getRef()
            ]
        );
    }
1268219
public function onUserRegistered(PostRegisterEvent $event): void
    {
        $user = $event->getUser();

        if ($user->enabled) {
            $this->mailHelper
                ->sendMail(
                    [$user->email => $this->getUserName($user)],
                    'ngsite.user.welcome.subject',
                    $this->configResolver->getParameter('template.user.mail.welcome', 'ngsite'),
                    [
                        'user' => $user,
                    ]
                );

            return;
        }

        $accountKey = $this->ezUserAccountKeyRepository->create($user->id);

        if ($this->configResolver->getParameter('user.require_admin_activation', 'ngsite')) {
            $this->mailHelper
                ->sendMail(
                    [$user->email => $this->getUserName($user)],
                    'ngsite.user.activate.admin_activation_pending.subject',
                    $this->configResolver->getParameter('template.user.mail.activate_admin_activation_pending', 'ngsite'),
                    [
                        'user' => $user,
                    ]
                );

            $adminEmail = $this->configResolver->getParameter('user.mail.admin_email', 'ngsite');
            $adminName = $this->configResolver->getParameter('user.mail.admin_name', 'ngsite');

            if (!empty($adminEmail)) {
                $this->mailHelper
                    ->sendMail(
                        !empty($adminName) ? [$adminEmail => $adminName] : [$adminEmail],
                        'ngsite.user.activate.admin_activation_required.subject',
                        $this->configResolver->getParameter('template.user.mail.activate_admin_activation_required', 'ngsite'),
                        [
                            'user' => $user,
                        ]
                    );
            }

            return;
        }

        $this->mailHelper
            ->sendMail(
                [$user->email => $this->getUserName($user)],
                'ngsite.user.activate.subject',
                $this->configResolver->getParameter('template.user.mail.activate', 'ngsite'),
                [
                    'user' => $user,
                    'hash' => $accountKey->getHash(),
                ]
            );
    }