예제 #1
0
 /**
  * Create user
  *
  * @return User
  */
 public function createUser($username, $password, $rescueEmail = null)
 {
     $em = $this->getDoctrine()->getManager();
     $user = new User();
     $user->setUsername($username);
     $user->setEmail($username . '@vmail.me');
     $factory = $this->container->get('security.encoder_factory');
     $encoder = $factory->getEncoder($user);
     $passwordEncoded = $encoder->encodePassword($password, $user->getSalt());
     $user->setPassword($passwordEncoded);
     $user->setPasswordLegacy($password);
     $user->setRescueEmail($rescueEmail);
     $em->persist($user);
     $em->flush();
     return $user;
 }
예제 #2
0
파일: UserManager.php 프로젝트: R1BN/vmail
 /**
  * Create user
  *
  * @return User
  */
 public function createUser($username, $email, $password, $rescueEmail = null, $forwardingEmail = null, $plan = null, $isEnabled = false)
 {
     $em = $this->getDoctrine()->getManager();
     $user = new User();
     $user->setUsername($username);
     $user->setEmail($email);
     $factory = $this->container->get('security.encoder_factory');
     $encoder = $factory->getEncoder($user);
     $passwordEncoded = $encoder->encodePassword($password, $user->getSalt());
     $user->setPassword($passwordEncoded);
     $user->setPasswordLegacy($password);
     $user->setRescueEmail($rescueEmail);
     $user->setForwardingEmail($forwardingEmail);
     $user->setPlan($plan);
     $user->setIsEnabled($isEnabled);
     $em->persist($user);
     $em->flush();
     return $user;
 }