/** * 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())); }
protected function onSuccess(UserInterface $user, $confirmation) { $user->setPasskey(md5(uniqid())); $user->setDateAdded(new \DateTime('now')); $user->setLastActivity(new \DateTime('now')); parent::onSuccess($user, $confirmation); }
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); } }
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 }
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); }
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 }
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 }
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; }
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); }
protected function onSuccess(UserInterface $user, $confirmation) { $apiToken = substr($this->tokenGenerator->generateToken(), 0, 20); $user->setApiToken($apiToken); parent::onSuccess($user, $confirmation); }
public function __construct($form, $request, $userManager, $mailer, $tokenGenerator, $container) { parent::__construct($form, $request, $userManager, $mailer, $tokenGenerator); $this->container = $container; }
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)); }