Beispiel #1
0
 /**
  * Status update refused
  *
  * @param User $user
  * @return void
  */
 protected function statusRefuse(User $user)
 {
     $this->sendMailService->send('updateRequestRefused', StringUtility::makeEmailArray($user->getEmail(), $user->getFirstName() . ' ' . $user->getLastName()), ['*****@*****.**' => 'Sender Name'], 'Your change request was refused', ['user' => $user, 'settings' => $this->settings], $this->config['edit.']['email.']['updateRequestRefused.']);
     LogUtility::log(Log::STATUS_PROFILEUPDATEREFUSEDADMIN, $user);
     $this->addFlashMessage(LocalizationUtility::translateByState(Log::STATUS_PROFILEUPDATEREFUSEDADMIN));
 }
 /**
  * Prefix method to updateAction()
  *        Update Confirmation from Admin is not necessary
  *
  * @param User $user
  * @return void
  */
 public function updateAllConfirmed(User $user)
 {
     // send notify email to admin
     $existingUser = clone $this->userRepository->findByUid($user->getUid());
     if ($this->settings['edit']['notifyAdmin']) {
         $this->sendMailService->send('updateNotify', StringUtility::makeEmailArray($this->settings['edit']['notifyAdmin'], $this->settings['edit']['email']['notifyAdmin']['receiver']['name']['value']), StringUtility::makeEmailArray($user->getEmail(), $user->getUsername()), 'Profile update', ['user' => $user, 'changes' => UserUtility::getDirtyPropertiesFromUser($existingUser), 'settings' => $this->settings], $this->config['edit.']['email.']['notifyAdmin.']);
     }
     $this->userRepository->update($user);
     $this->persistenceManager->persistAll();
     $this->signalSlotDispatcher->dispatch(__CLASS__, __FUNCTION__ . 'AfterPersist', [$user, $this]);
     LogUtility::log(Log::STATUS_PROFILEUPDATED, $user, ['existingUser' => $existingUser]);
     $this->redirectByAction('edit');
     $this->addFlashMessage(LocalizationUtility::translate('update'));
 }
Beispiel #3
0
 /**
  * Autogenerate username and password if it's empty
  *
  * @param User $user
  * @return User $user
  */
 public static function fallbackUsernameAndPassword(User $user)
 {
     $settings = self::getConfigurationManager()->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS);
     $autogenerateSettings = $settings['new']['misc']['autogenerate'];
     if (!$user->getUsername()) {
         $user->setUsername(StringUtility::getRandomString($autogenerateSettings['username']['length'], $autogenerateSettings['username']['addUpperCase'], $autogenerateSettings['username']['addSpecialCharacters']));
         if ($user->getEmail()) {
             $user->setUsername($user->getEmail());
         }
     }
     if (!$user->getPassword()) {
         $password = StringUtility::getRandomString($autogenerateSettings['password']['length'], $autogenerateSettings['password']['addUpperCase'], $autogenerateSettings['password']['addSpecialCharacters']);
         $user->setPassword($password);
         $user->setPasswordAutoGenerated($password);
     }
     return $user;
 }