Handles a successful password change using the FOSUserBundle forms

@param \FOS\UserBundle\Event\FormEvent $event
495602
public function handlePasswordChangeSuccess(FOSFormEvent $event)
    {
        $form = $event->getForm();
        $user = $form->getData();

        if ($user instanceof PKEncryptionEnabledUserInterface) {
            $currentPassword = $form->get('current_password')->getData();
            $this->encryptionService->handleUserPasswordChangeSuccess($user, $currentPassword);
        }
    }
101639
public function onBind(FormEvent $event)
    {
        // BC prevention for class extending this one.
        if (self::class !== \get_called_class()) {
            @trigger_error(
                __METHOD__.' is deprecated since 2.3 and will be renamed in 4.0.'
                .' Use '.__CLASS__.'::onSubmit instead.',
                E_USER_DEPRECATED
            );
        }

        $this->onSubmit($event);
    }
704978
public function handleEvent(Event $event)
    {
        if (!$event instanceof UserInfoWithPassword) {
            throw new InvalidArgumentException(t('Invalid event type provided. Event type must be "UserInfoWithPassword".'));
        }

        // Track the password use
        $this->tracker->trackUse($event->getUserPassword(), $event->getUserInfoObject());
    }
700502
public function preSetData(FormEvent $event)
    {  
        $entity = $event->getData();

        if ($entity instanceof ImageInterface && null !== $entity->getId()){
            try{
                $this->imageManager->copyImagesToTemporaryDirectory($entity);
            } catch(\Gaufrette\Exception\FileNotFound $e){ 
                $event->setData(null);
            }
        }
    }
1144217
public function beforeSave(Event $event)
    {
        if (isset($this->_controller()->request->data['password'])) {
            $password = $this->_controller()->request->data['password'];
            $event->subject->entity['password'] = $password;
        }
    }
195590
public function onSubmit(FormEvent $event)
    {
        $form = $event->getForm()->getParent();
        $data = $form->getData();

        if (!\is_object($data)) {
            return;
        }

        $accessor = PropertyAccess::createPropertyAccessor();
        $newCollection = $accessor->getValue($data, $this->name);
        if (!$newCollection instanceof Collection) {
            return;
        }
        /* @var $newCollection Collection */

        $newCollection->clear();

        /** @var $item FormBuilder */
        foreach ($form->get($this->name) as $key => $item) {
            if ($item->get('_delete')->getData()) {
                // do not re-add a deleted child
                continue;
            }
            if ($item->getName() && !is_numeric($item->getName())) {
                // keep key in collection
                $newCollection[$item->getName()] = $item->getData();
            } else {
                $newCollection[] = $item->getData();
            }
        }
    }
391935
public function preSubmit(FormEvent $event): void
    {
        $rawData = $event->getData();
        $form = $event->getForm();
        $data = $form->getData();

        Assert::isInstanceOf($data, CustomerInterface::class);

        // if email is not filled in, go on
        if (!isset($rawData['email']) || empty($rawData['email'])) {
            return;
        }

        /** @var CustomerInterface|null $existingCustomer */
        $existingCustomer = $this->customerRepository->findOneBy(['email' => $rawData['email']]);
        if (null === $existingCustomer || null !== $existingCustomer->getUser()) {
            return;
        }

        $existingCustomer->setUser($data->getUser());
        $form->setData($existingCustomer);
    }
840435
public function changeUserPassword(
        UserPasswordChangeData $data = null,
        ?string $name = null,
        ?User $user = null
    ): FormInterface {
        $name = $name ?: StringUtil::fqcnToBlockPrefix(UserPasswordChangeType::class);

        return $this->formFactory->createNamed($name, UserPasswordChangeType::class, $data, [
            'user' => $user,
        ]);
    }
862885
public function preSubmit(FormEvent $event)
    {
        $form = $event->getForm();
        $formHash = $this->getFormHash($form);
        $this->submittedDataPlain[$formHash] = $event->getData();
    }
983732
public function handleHandleHttpRequestEvent(HandleHttpRequestEvent $event) {
        $event->setResponse(
            $this->requestHandler->handle($event->getRequest())
        );
    }
518862
public function passwordFormSucceeded(Form $form, ArrayHash $values): void
	{
		try {
			$this->profile->setPassword($values->password, $values->oldPassword);
			$this->orm->persistAndFlush($this->profile);
			$this->flashNotifier->success('cms.user.passwordChanged');
		} catch (AuthenticationException $e) {
			$form->addError('cms.user.incorrectPassword');
		}
		if ($this->isAjax()) {
			$this->redrawControl('passwordForm');
		}
	}
127443
public function handle(UpdatedEvent $event)
    {
        if ($event->oldemail === $event->user->email) {
            $data = sprintf('**Verified:** _<%s>_', $event->user->email);
        } else {
            $data = implode("\n", [
                sprintf('**Updated:** _<%s>_', $event->user->email),
                sprintf('**Old:** _<%s>_', $event->oldemail),
            ]);
        }

        $this->track(Settings::TYPEID_UPDATED, $event->user->id, 25, $data);
    }
96925
public function sendEmail(PasswordRememberEvent $event)
    {
        $this->renderEmail(
            'Password remember email',
            $event->getUser()->getEmail(),
            [
                'user' => $event->getUser(),
                'rememberUrl' => $event->getRememberUrl(),
            ]
        );
    }
216222
public function handle(UpdatedEvent $event)
    {
        // Delete sessions for user on password update
        if ($this->config->get('session.driver') === 'laranix') {
            Session::where('user_id', $event->user->id)->delete();
        }

        $this->track(Settings::TYPEID_UPDATED, $event->user->id, 50);
    }
193012
public function preSetData(FormEvent $event)
    {
        $form = $event->getForm();

        foreach ($form as $name => $child) {
            $form->remove($name);
        }
    }
598279
public function onPreSubmitData(FormEvent $event)
    {
        $data = $event->getData();
        if (!array_key_exists('site_root', $data) || false === (bool)$data['site_root']) {
            $location = $this->locationService->loadLocation($data['location']);
            if (1 >= $location->depth) {
                return;
            }
            $parentLocation = $this->locationService->loadLocation($location->parentLocationId);
            $urlAlias = $this->urlAliasService->reverseLookup($parentLocation);
            $data['path'] = $urlAlias->path . '/' . $data['path'];
            $event->setData($data);
        }
    }
146573
public function postSetData(FormEvent $event)
    {
        $collection = $event->getData();
        $form = $event->getForm();

        if ($collection instanceof PersistentCollection){
            foreach ($collection as $key => $file){
                if ($file instanceof MultiFileInterface){
                    try {
                        $this->fileManager->copyFileToTemporaryDirectory($file);
                    } catch (\Gaufrette\Exception\FileNotFound $e) {
                        $form->remove($key);
                        $collection->removeElement($file);
                    }
                }
            }
        }
    }