protected function onSuccess(UserInterface $user) { $user->setPlainPassword($this->getNewPassword()); $user->setConfirmationToken(null); $user->setEnabled(true); $this->userManager->updateUser($user); }
/** * @param boolean $confirmation */ protected function onSuccess(UserInterface $user, $confirmation) { if ($confirmation) { $user->setEnabled(false); if (null === $user->getConfirmationToken()) { $user->setConfirmationToken($this->tokenGenerator->generateToken()); } $this->mailer->sendConfirmationEmailMessage($user); } else { $user->setEnabled(true); } $this->userManager->updateUser($user); }
public function process(UserInterface $user) { $this->form->setData(new ResetPassword($user)); if ('POST' == $this->request->getMethod()) { $this->form->bindRequest($this->request); if ($this->form->isValid()) { $user->setPlainPassword($this->getNewPassword()); $user->setConfirmationToken(null); $user->setEnabled(true); $this->userManager->updateUser($user); return true; } } return false; }
protected function onSuccess(UserInterface $user, $confirmation) { if ($confirmation) { $user->setEnabled(false); if (null === $user->getConfirmationToken()) { $user->setConfirmationToken($this->tokenGenerator->generateToken()); } $this->mailer->sendConfirmationEmailMessage($user); } else { $user->setEnabled(true); } $user->setRoles(array('ROLE_CLIENT')); $user->setEnabled(true); $user->setLastLogin(new \DateTime()); }
/** * @param boolean $confirmation */ protected function onSuccess(UserInterface $user, $confirmation) { if ($confirmation) { $user->setEnabled(false); if (null === $user->getConfirmationToken()) { $user->setConfirmationToken($this->tokenGenerator->generateToken()); } $this->mailer->sendConfirmationEmailMessage($user); } else { $user->setEnabled(true); } $event = new FormEvent($this->form, $this->request); $this->event_dispatcher->dispatch(FOSUserEvents::REGISTRATION_SUCCESS, $event); $this->userManager->updateUser($user); }
protected function onSuccess(UserInterface $user, $confirmation) { if ($confirmation) { $user->setEnabled(false); if (null === $user->getConfirmationToken()) { $user->setConfirmationToken($this->tokenGenerator->generateToken()); } $this->mailer->sendConfirmationEmailMessage($user); } else { $user->setEnabled(true); } $user->setRoles(array('ROLE_RIA')); $riaCompanyInformation = new RiaCompanyInformation(); $riaCompanyInformation->setName($user->getProfile()->getCompany()); $riaCompanyInformation->setRia($user); $user->setRiaCompanyInformation($riaCompanyInformation); $this->userManager->updateUser($user); if ($riaCompanyInformation->getRelationshipType() === RiaCompanyInformation::RELATIONSHIP_TYPE_LICENSE_FEE) { $this->feeManager->resetRiaFee($user); } }
/** * Send mail to reset user password (return URL) * * @param UserInterface $user * @param string $route_reset_connexion * @param string $title * @param array $parameters * * @return string * @access public * @author Etienne de Longeaux <*****@*****.**> */ public function sendResettingEmailMessageURL(UserInterface $user, $route_reset_connexion, $parameters = array()) { $tokenGenerator = $this->container->get('fos_user.util.token_generator'); $user->setConfirmationToken($tokenGenerator->generateToken()); $em = $this->container->get('doctrine')->getManager(); $em->persist($user); $em->flush(); $this->container->get('request')->getSession()->set(static::SESSION_EMAIL, $this->getObfuscatedEmail($user)); $parameters = array_merge($parameters, array('token' => $user->getConfirmationToken())); $url = $this->container->get('sfynx.tool.route.factory')->getRoute($route_reset_connexion, $parameters); $html_url = 'http://' . $this->container->get('request')->getHttpHost() . $this->container->get('request')->getBasePath() . $url; return $html_url; }
/** * Return the token object. * * @param UserInterface $user * * @return UsernamePasswordToken * @access public * @author Etienne de Longeaux <*****@*****.**> */ public function tokenUser(UserInterface $user) { $tokenGenerator = $this->container->get('fos_user.util.token_generator'); $user->setConfirmationToken($tokenGenerator->generateToken()); $em = $this->container->get('doctrine')->getManager(); $em->persist($user); $em->flush(); $this->container->get('request')->getSession()->set(PiMailerManager::SESSION_EMAIL, $this->container->get('sfynx.auth.mailer')->getObfuscatedEmail($user)); return $user->getConfirmationToken(); }
/** * @param UserInterface $user */ protected function onSuccess(UserInterface $user) { // Disabling user password registration // $user->setPlainPassword($this->getNewPassword()); $user->setConfirmationToken(null); $user->setPasswordRequestedAt(null); $user->setEnabled(true); $this->userManager->updateUser($user); // getting DB user $dbUser = $this->em->getRepository('SpiritDevDBoxUserBundle:User')->findOneByUsername($user->getUsername()); // Updating LDAP Password $this->ldap->ldapUpdatePassword($dbUser, $this->getNewPassword()); }
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); if ($confirmation) { $user->setEnabled(false); $tokenGenerator = $this->container->get('fos_user.util.token_generator'); $user->setConfirmationToken($tokenGenerator->generateToken()); $this->mailer->sendConfirmationEmailMessage($user); } else { $user->setConfirmationToken(null); $user->setEnabled(true); } $this->userManager->updateUser($user); // otherwise add your functionality here }