コード例 #1
0
 public function authenticate(FilterUserResponseEvent $event, $eventName = null, EventDispatcherInterface $eventDispatcher = null)
 {
     if (!$event->getUser()->isEnabled()) {
         return;
     }
     $config = new Config($event->getUser());
     $config->setTheme($this->theme);
     $config->setItemsPerPage($this->itemsOnPage);
     $config->setRssLimit($this->rssLimit);
     $config->setLanguage($this->language);
     $this->em->persist($config);
     $this->em->flush();
 }
コード例 #2
0
 public function authenticate(FilterUserResponseEvent $event)
 {
     if (!$event->getUser()->isEnabled()) {
         return;
     }
     try {
         $this->loginManager->loginUser($this->firewallName, $event->getUser(), $event->getResponse());
         $event->getDispatcher()->dispatch(FOSUserEvents::SECURITY_IMPLICIT_LOGIN, new UserEvent($event->getUser(), $event->getRequest()));
     } catch (AccountStatusException $ex) {
         // We simply do not authenticate users which do not pass the user
         // checker (not enabled, expired, etc.).
     }
 }
コード例 #3
0
 public function fosProfileEditCompleted(FilterUserResponseEvent $event, $eventName = null, EventDispatcherInterface $eventDispatcher = null)
 {
     $em = $this->em;
     if (!$event->getUser()->isEnabled()) {
         return;
     }
     $user = $event->getUser();
     if ($user->getAthlete() == null) {
         $athlete = new Athlete();
         $athlete->setName($user->getUsername());
         $user->setAthlete($athlete);
         $em->persist($athlete);
         $em->flush();
     }
 }
コード例 #4
0
 /**
  * @param FilterUserResponseEvent $event
  * @param array $default
  * @return array
  */
 public function resolve($event, $default = array())
 {
     if (!$event instanceof FilterUserResponseEvent) {
         return $default;
     }
     return $this->getEventDetailsArray("Password Changed", "Password of user '%s' Changed Successfully", $event->getUser()->getUsername());
 }
コード例 #5
0
 function it_should_not_email_disabled_users(FilterUserResponseEvent $event, UserInterface $user, $mailer)
 {
     $user->isEnabled()->willReturn(false);
     $event->getUser()->willReturn($user);
     $mailer->sendCustomerWelcome($user)->shouldNotBeCalled();
     $this->handleEvent($event);
 }
コード例 #6
0
 /**
  * @param FilterUserResponseEvent $event
  * @return array
  */
 public function resolve($event)
 {
     if ($event instanceof FilterUserResponseEvent) {
         return $this->getEventDetailsArray($event->getUser()->getUsername());
     }
     return null;
 }
コード例 #7
0
 public function resetCompleted(FilterUserResponseEvent $event)
 {
     /** @var User $user */
     $user = $event->getUser();
     $user->setCredentialsExpired(false);
     $this->manager->updateUser($user);
 }
コード例 #8
0
 /**
  * @param FilterUserResponseEvent $event
  */
 public function onRegistrationComplete(FilterUserResponseEvent $event)
 {
     $user = $event->getUser();
     $user->setMcUuid($this->minecraft->fetchUUID($user->getUsername()));
     $this->em->flush();
     return;
 }
コード例 #9
0
 public function createAPlayer(FilterUserResponseEvent $event)
 {
     $user = $event->getUser();
     $player = new Player();
     //$this->em->persist($player);
     $user->setPlayer($player);
     $this->em->flush();
 }
コード例 #10
0
 public function onRegistrationCompleted(FilterUserResponseEvent $event)
 {
     $user = $event->getUser();
     $user->addRole("ROLE_USER");
     $request = $event->getRequest();
     $this->em->persist($user);
     $this->em->flush();
     return $event;
 }
コード例 #11
0
 public function onUserAccountDisabled(FilterUserResponseEvent $event)
 {
     $user = $event->getUser();
     if ($user instanceof User) {
         $audit = AuditLog::make($user, 'account-deleted', $event->getRequest()->getClientIp());
         $this->em->persist($audit);
         $this->em->flush();
     }
 }
コード例 #12
0
 /**
  * Event automatically fired when user is registered
  *
  * @param FilterUserResponseEvent $event
  */
 public function onUserRegistered(FilterUserResponseEvent $event)
 {
     /** @var User $user */
     $user = $event->getUser();
     $name = 'Unasigned actions';
     $task = new Task($name, $user);
     $task->setDefault(true);
     $this->taskRepository->save($task);
 }
コード例 #13
0
 public function onRegistrationCompleted(FilterUserResponseEvent $event)
 {
     $user = $event->getUser();
     $tenantName = $this->_form->get('tenantName')->getData();
     $tenantSubdomain = $this->_form->get('tenantSubdomain')->getData();
     $tenant = $this->registrationManager->createTenant($user, $tenantName, $tenantSubdomain);
     // this referenced redirect response will be used
     $this->redirectResponse->setTargetUrl($this->tenantAwareRouter->generateUrl($tenant));
     unset($this->_form);
 }
コード例 #14
0
 public function onUserCreation(FilterUserResponseEvent $event)
 {
     $user = $event->getUser();
     // Create home project
     $home = new Project();
     $this->projectManager->saveProject($home);
     $this->projectManager->setHome($home, $user);
     // set project as current project in session
     $this->session->set('projectid', $home->getId());
 }
 public function onChangePasswordCompleted(FilterUserResponseEvent $event)
 {
     $user = $event->getUser();
     $passwordHistory = new PasswordHistory();
     $passwordHistory->setUser($user);
     $passwordHistory->setPassword($user->getPassword());
     $passwordHistory->setSalt($user->getSalt());
     $this->em->persist($passwordHistory);
     $this->em->flush();
     return $event;
 }
コード例 #16
0
 /**
  * @param FilterUserResponseEvent $event
  *
  * @throws UnexpectedTypeException
  */
 public function handleEvent(FilterUserResponseEvent $event)
 {
     $user = $event->getUser();
     if (!$user instanceof UserInterface) {
         throw new UnexpectedTypeException($user, 'Sylius\\Component\\Core\\Model\\UserInterface');
     }
     if (!$user->isEnabled()) {
         return;
     }
     $this->mailer->sendCustomerWelcome($user);
 }
コード例 #17
0
ファイル: UserEventListener.php プロジェクト: ojs/ojs
 /**
  * @param FilterUserResponseEvent $event
  */
 public function onRegistrationCompleted(FilterUserResponseEvent $event)
 {
     $getMailEvent = $this->ojsMailer->getEventByName(FOSUserEvents::REGISTRATION_COMPLETED);
     if (!$getMailEvent) {
         return;
     }
     /** @var User $user */
     $user = $event->getUser();
     $transformParams = ['user.username' => $user->getUsername(), 'user.fullName' => $user->getFullName(), 'user.mail' => $user->getEmail()];
     $template = $this->ojsMailer->transformTemplate($getMailEvent->getTemplate(), $transformParams);
     $this->ojsMailer->sendToUser($user, $getMailEvent->getSubject(), $template);
 }
コード例 #18
0
 public function finishRegistration(FilterUserResponseEvent $event)
 {
     $token = $this->getToken($event->getRequest());
     $invitation = $this->getInvitation($token);
     $player = $invitation->getPlayer();
     /** @var User $user */
     $user = $event->getUser();
     $user->setPlayer($player);
     $player->setName($user->getUsername());
     $this->entityManager->persist($user);
     $this->entityManager->flush();
     // TODO delete invitation? keep it?
 }
コード例 #19
0
 public function onRegistrationCompleted(FilterUserResponseEvent $event)
 {
     $user = $event->getUser();
     $auth = new Authorization();
     $auth->setPerson($user);
     $auth->setClient($this->notificationHandler->getLoginCidadaoClient());
     $auth->setScope(explode(' ', $this->lcSupportedScopes));
     $this->em->persist($auth);
     $this->em->flush();
     $this->mailer->sendConfirmationEmailMessage($user);
     if (strlen($user->getPassword()) == 0) {
         $this->notificationsHelper->enforceEmptyPasswordNotification($user);
     }
 }
コード例 #20
0
 /**
  * Añade el Rol correspondiente según el tipo de usuario seleccionado en
  * el formulario de registro.
  *
  * @param FilterUserResponseEvent $event
  */
 public function onAddDefaultRoleSuccess(FilterUserResponseEvent $event)
 {
     $em = $this->doctrine->getManager();
     $user = $event->getUser();
     /** @var $user \FOS\UserBundle\Model\UserInterface */
     if ($user->getType()->getCode() == 'developer') {
         $user->addRole('ROLE_DEVELOPER');
     }
     if ($user->getType()->getCode() == 'requisiter') {
         $user->addRole('ROLE_REQUISITER');
     }
     $em->persist($user);
     $em->flush();
 }
コード例 #21
0
 public function onRegistrationCompleted(FilterUserResponseEvent $event)
 {
     $user = $event->getUser();
     $user_email = $user->getEmail();
     $em = $this->doctrine->getEntityManager();
     $invitations = $this->doctrine->getRepository('EventBundle:EventMail')->findBy(['email' => $user_email]);
     if ($invitations != null) {
         foreach ($invitations as $invitation) {
             $event = $invitation->getEvent();
             $event->addUser($user);
             $em->remove($invitation);
         }
         $em->flush();
     }
 }
コード例 #22
0
 public function onRegistrationCompleted(FilterUserResponseEvent $event)
 {
     $user = $event->getUser();
     $auth = new Authorization();
     $auth->setPerson($user);
     $auth->setClient($this->clientRepository->findOneBy(['uid' => $this->defaultClientUid]));
     $auth->setScope(explode(' ', $this->lcSupportedScopes));
     $this->em->persist($auth);
     $this->em->flush();
     $this->mailer->sendConfirmationEmailMessage($user);
     if (strlen($user->getPassword()) == 0) {
         // TODO: DEPRECATE NOTIFICATIONS
         // TODO: create an optional task offering users to set a password
         //$this->notificationsHelper->enforceEmptyPasswordNotification($user);
     }
     $this->registerRequestedScope->clearRequestedScope($event->getRequest());
 }
コード例 #23
0
 public function onRegistrationComleted(FilterUserResponseEvent $event)
 {
     $this->affiliate->recordRegistration($event->getResponse(), $event->getUser());
 }
コード例 #24
0
 public function onRegistrationSuccess(FilterUserResponseEvent $event)
 {
     $user = $event->getUser();
     $user->addRole('ROLE_AUTHOR');
     $this->um->updateUser($user);
 }
コード例 #25
0
 /**
  * @param FilterUserResponseEvent $event
  */
 public function onPasswordResettingSuccess(FilterUserResponseEvent $event)
 {
     $user = $event->getUser();
     $user->setPasswordChanged(true);
     $this->userManager->updateUser($user);
 }
コード例 #26
0
ファイル: UserEventListener.php プロジェクト: ulakjira/ojs
 /**
  * @param FilterUserResponseEvent $userResponseEvent
  */
 public function onRegistrationCompleted(FilterUserResponseEvent $userResponseEvent)
 {
     $user = $userResponseEvent->getUser();
     $this->sendMail($user, 'User Event : User Registration', 'User Event -> User Registration Completed -> ' . $user->getEmail());
 }
コード例 #27
0
 public function onRegistrationCompleted(FilterUserResponseEvent $event)
 {
     $user = $event->getUser();
     $this->manager->setUserAgreed($user);
 }
コード例 #28
0
 public function onRegistrationConfirmed(FilterUserResponseEvent $event)
 {
     // $junior = $this->container->getParameter('junior');  //ligne faisant bugger la validation, skippé pour un remplacement. TODO : Regler ce problème.
     $message = \Swift_Message::newInstance()->setSubject('Incipio : Nouvel utilisateur ' . $event->getUser()->getUsername())->setFrom('*****@*****.**')->setTo('*****@*****.**')->setBody($this->templating->render('MgateUserBundle:Default:alert-email.html.twig', array('username' => $event->getUser()->getUsername(), 'email' => $event->getUser()->getEmail())), 'text/html');
     $this->mailer->send($message);
 }
コード例 #29
0
 public function onChangePasswordCompleted(FilterUserResponseEvent $event)
 {
     $user = $event->getUser();
     $this->notificationHelper->clearEmptyPasswordNotification($user);
 }
コード例 #30
0
ファイル: ReferralListener.php プロジェクト: suspended/forex
 /**
  * @DI\Observe("fos_user.registration.completed")
  */
 public function addReferrerToUser(FilterUserResponseEvent $event)
 {
     $request = $event->getRequest();
     // No cookie, no nookie
     if (!($referralId = $request->cookies->get(self::REFERRAL_COOKIE))) {
         return;
     }
     // Find the referrer
     $referrer = $this->em->getRepository('ForexCoreBundle:User')->findOneById($referralId);
     if (!$referrer) {
         return;
     }
     $user = $event->getUser();
     $this->referralManager->addReferrerToUser($user, $referrer);
     $this->em->flush();
 }