コード例 #1
0
ファイル: AgentController.php プロジェクト: Jrbebel/Inra
 /**
  * function description
  * Creation d'un Agent 
  */
 public function CreateAgentAction()
 {
     $userManager = $this->get('fos_user.user_manager');
     $userMail = $this->get('fos_user.mailer');
     $formbuilder = $this->createForm(new UserType($userManager->getClass()));
     $formhandler = new RegistrationFormHandler($formbuilder, $this->get('request'), $userManager, $userMail, $this->container->get('fos_user.util.token_generator'));
     if ($formhandler->process()) {
         return $this->render('Inra2013urzBundle:Registration:save.html.twig', array('Status' => "Create"));
     }
     return $this->render('Inra2013urzBundle:Registration:register.html.twig', array('form' => $formbuilder->createView()));
 }
コード例 #2
0
 protected function onSuccess(UserInterface $user, $confirmation)
 {
     $user->setPasskey(md5(uniqid()));
     $user->setDateAdded(new \DateTime('now'));
     $user->setLastActivity(new \DateTime('now'));
     parent::onSuccess($user, $confirmation);
 }
コード例 #3
0
 protected function onSuccess(UserInterface $user, $confirmation)
 {
     $group = $this->groupManager->findGroupBy(array('id' => 2));
     if (!empty($group)) {
         $role = new UserRole();
         $role->setGroupe($group);
         $role->setUser($user);
         $role->setRole("usr");
         $this->em->persist($role);
         $this->em->flush();
         $user->addGroup($group);
         $user->setChosenGroup($group);
     }
     parent::onSuccess($user, $confirmation);
     $mainBotAccount = $this->userManager->findUserBy(array('id' => 20));
     if ($this->registrationMessage->hasMessage()) {
         $content = $this->registrationMessage->getMessage();
     } else {
         $content = '';
     }
     if (!empty($mainBotAccount) && !empty($content)) {
         $salon = new Salon();
         $salon->setName('Discussion privée');
         $salon = $this->salonManager->createSalon($salon, array($user, $mainBotAccount), array($user), true);
         $message = $this->persistManager->buildMessage($mainBotAccount, $salon, $content, new \DateTime());
         $this->persistManager->persistMessage($message);
     }
 }
コード例 #4
0
 protected function onSuccess(UserInterface $user, $confirmation)
 {
     // Note: if you plan on modifying the user then do it before calling the
     // parent method as the parent method will flush the changes
     parent::onSuccess($user, $confirmation);
     // otherwise add your functionality here
 }
コード例 #5
0
 protected function onSuccess(UserInterface $user, $confirmation)
 {
     $user->setUsername($user->getUsername());
     $user->setLocked(false);
     $user->setEnabled(true);
     $user->setCreatedAt(new \DateTime('now'));
     $em = $this->container->get('doctrine.odm.mongodb.document_manager');
     parent::onSuccess($user, $confirmation);
 }
コード例 #6
0
 protected function onSuccess(UserInterface $user, $confirmation)
 {
     // Note: if you plan on modifying the user then do it before calling the
     // parent method as the parent method will flush the changes
     $user->addRole('ROLE_NORMAL_USER');
     $user->setRegistrationStatus('complete');
     $user->setSalt($this->random_key_generator(20));
     parent::onSuccess($user, $confirmation);
     // otherwise add your functionality here
 }
コード例 #7
0
 protected function onSuccess(UserInterface $user, $confirmation)
 {
     // Note: if you plan on modifying the user then do it before calling the
     // parent method as the parent method will flush the changes
     /* @var $user \Projet0\Homepage\LoginBundle\Entity\User */
     $group = $this->container->get('doctrine')->getEntityManager()->getRepository('Projet0HomepageLoginBundle:Group')->findOneByName($this->defaultGroup);
     if ($group) {
         $user->addGroup($group);
     }
     parent::onSuccess($user, $confirmation);
     // otherwise add your functionality here
 }
コード例 #8
0
 public function __construct(FormInterface $form, Request $request, UserManagerInterface $userManager, MailerInterface $mailer, TokenGeneratorInterface $tokenGenerator, FeeManager $feeManager)
 {
     parent::__construct($form, $request, $userManager, $mailer, $tokenGenerator);
     $this->feeManager = $feeManager;
 }
コード例 #9
0
 public function __construct(FormInterface $form, Request $request, UserManagerInterface $userManager, MailerInterface $mailer, TokenGeneratorInterface $tokenGenerator, UserDiscriminator $userDiscriminator)
 {
     $this->userDiscriminator = $userDiscriminator;
     $form = $userDiscriminator->getRegistrationForm();
     parent::__construct($form, $request, $userManager, $mailer, $tokenGenerator);
 }
コード例 #10
0
 protected function onSuccess(UserInterface $user, $confirmation)
 {
     $apiToken = substr($this->tokenGenerator->generateToken(), 0, 20);
     $user->setApiToken($apiToken);
     parent::onSuccess($user, $confirmation);
 }
コード例 #11
0
 public function __construct($form, $request, $userManager, $mailer, $tokenGenerator, $container)
 {
     parent::__construct($form, $request, $userManager, $mailer, $tokenGenerator);
     $this->container = $container;
 }
コード例 #12
0
 protected function onSuccess(UserInterface $user, $confirmation)
 {
     parent::onSuccess($user, $confirmation);
     $this->mailer->sendNewUserEmailMessage($user, $this->request->get('fos_user_registration_form[plainPassword][first]', null, true));
 }