/**
  * Process form
  *
  * @param AccountUser $accountUser
  * @return bool True on successful processing, false otherwise
  */
 public function process(AccountUser $accountUser)
 {
     if (in_array($this->request->getMethod(), ['POST', 'PUT'], true)) {
         $this->form->submit($this->request);
         if ($this->form->isValid()) {
             if (!$accountUser->getId()) {
                 if ($this->form->get('passwordGenerate')->getData()) {
                     $generatedPassword = $this->userManager->generatePassword(10);
                     $accountUser->setPlainPassword($generatedPassword);
                 }
                 if ($this->form->get('sendEmail')->getData()) {
                     $this->userManager->sendWelcomeEmail($accountUser);
                 }
             }
             $token = $this->securityFacade->getToken();
             if ($token instanceof OrganizationContextTokenInterface) {
                 $organization = $token->getOrganizationContext();
                 $accountUser->setOrganization($organization)->addOrganization($organization);
             }
             $this->userManager->updateUser($accountUser);
             return true;
         }
     }
     return false;
 }
 /**
  * @dataProvider welcomeEmailDataProvider
  *
  * @param bool $sendPassword
  */
 public function testSendWelcomeEmail($sendPassword)
 {
     $password = '******';
     $user = new AccountUser();
     $user->setPlainPassword($password);
     $this->emailProcessor->expects($this->once())->method('sendWelcomeNotification')->with($user, $sendPassword ? $password : null);
     $this->configManager->expects($this->once())->method('get')->with('oro_b2b_account.send_password_in_welcome_email')->willReturn($sendPassword);
     $this->userManager->sendWelcomeEmail($user);
 }