public function updatePassword(User $user)
 {
     if (0 !== strlen($password = $user->getPlainPassword())) {
         $encoder = $this->getEncoder($user);
         $user->setPassword($encoder->encodePassword($password, $user->getSalt()));
         $user->eraseCredentials();
     }
 }
Exemple #2
0
 /**
  * @param CuteFlow\CoreBundle\Entity\User $user
  * @return void
  */
 public function sendWelcomeEmailMessage(User $user)
 {
     if ($this->settingsManager->getSettings()->getEmailFormat() == 'text/plain') {
         $template = $this->parameters['welcome.template'] . ".text.twig";
     } else {
         $template = $this->parameters['welcome.template'] . ".html.twig";
     }
     $url = $this->router->generate('cuteflow_dashboard', array(), true);
     $rendered = $this->templating->render($template, array('user' => $user, 'homepage' => $url, 'footer' => $this->settingsManager->getSettings()->getEmailFooter()));
     $this->sendEmailMessage($rendered, $user->getEmail());
 }
 public function load($manager)
 {
     $userAdmin = new User();
     $userAdmin->setUsername('admin');
     $userAdmin->setLocale('en');
     $userAdmin->setEmail('*****@*****.**');
     $userAdmin->setLastName('Admin');
     $userAdmin->setFirstName('Admin');
     $userAdmin->addRole(User::ROLE_CUTEFLOW_ADMIN);
     $userAdmin->addRole(User::ROLE_CUTEFLOW_USER);
     $encoder = $this->container->get('security.encoder_factory')->getEncoder($userAdmin);
     $userAdmin->setPassword($encoder->encodePassword('admin', $userAdmin->getSalt()));
     $group = new \CuteFlow\CoreBundle\Entity\UserGroup();
     $group->setName('Testgroup');
     //        $userAdmin->addGroups($group);
     $manager->persist($userAdmin);
     $manager->flush();
 }