本文整理汇总了PHP中AppBundle\Entity\User::setPlainPassword方法的典型用法代码示例。如果您正苦于以下问题:PHP User::setPlainPassword方法的具体用法?PHP User::setPlainPassword怎么用?PHP User::setPlainPassword使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppBundle\Entity\User
的用法示例。
在下文中一共展示了User::setPlainPassword方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadUserByOAuthUserResponse
/**
* {@inheritdoc}
*/
public function loadUserByOAuthUserResponse(UserResponseInterface $response)
{
$userEmail = $response->getEmail();
$user = $this->userManager->findUserByEmail($userEmail);
// if null just create new user and set it properties
if (null === $user) {
$userData = $response->getResponse();
$user = new User();
$user->setUsername($userData['formattedName']);
$user->setPlainPassword(rand(1000000, 10000000));
//TODO:find a better option
//TODO: add location, company name, ..
$user->setEmail($response->getEmail());
$user->setEnabled(true);
$this->userManager->updateUser($user);
$this->em->flush();
return $user;
}
// else update access token of existing user
$serviceName = $response->getResourceOwner()->getName();
$setter = 'set' . ucfirst($serviceName) . 'AccessToken';
$user->{$setter}($response->getAccessToken());
//update access token
return $user;
}
示例2: load
/**
* {@inheritDoc}
*/
public function load(ObjectManager $manager)
{
$userAdmin = new User();
$userAdmin->setUsername('ricardo75');
$userAdmin->setFirstName('richard');
$userAdmin->setLastName('lawson');
$userAdmin->setEmail('richard@network90.com');
$userAdmin->setPlainPassword('aberdeen');
$userAdmin->setRoles(array('ROLE_SUPER_ADMIN'));
$userAdmin->setEnabled(true);
$user = new User();
$user->setUsername('flipshark');
$user->setFirstName('mick');
$user->setLastName('jagger');
$user->setEmail('lawson_richard@hotmail.com');
$user->setPlainPassword('aberdeen');
$user->setRoles(array('ROLE_USER'));
$user->setEnabled(true);
$user2 = new User();
$user2->setUsername('elcondor');
$user2->setFirstName('keith');
$user2->setLastName('richards');
$user2->setEmail('richard@hotmail.com');
$user2->setPlainPassword('aberdeen');
$user2->setRoles(array('ROLE_USER'));
$user2->setEnabled(true);
$manager->persist($userAdmin);
$manager->persist($user);
$manager->persist($user2);
$manager->flush();
$this->addReference('user-ricardo75', $userAdmin);
$this->addReference('user-flipshark', $user);
}
示例3: loadUser2
private function loadUser2(ObjectManager $manager)
{
$user = new User();
$user->setUsername('user2');
$user->setEmail('user2@gmail.com');
$user->setPlainPassword('user2_pass');
$user->addRole(User::ROLE_SUPER_ADMIN);
$manager->persist($user);
$manager->flush($user);
$this->addReference('user_user2', $user);
}
示例4: load
public function load(ObjectManager $manager)
{
$user = new User();
$user->setUsername('testuser');
$user->setPlainPassword('testpass');
$user->setEmail('test@example.com');
$user->setEnabled(true);
$manager->persist($user);
$manager->flush();
$this->addReference('test-user', $user);
}
示例5: load
/**
* {@inheritDoc}
*/
public function load(ObjectManager $manager)
{
$user = new User();
$user->setUsername('admin');
$user->setEmail('admin@test.com');
$user->setPlainPassword('test');
$user->setEnabled(true);
$user->setRoles(array('ROLE_ADMIN'));
$manager->persist($user);
$manager->flush();
}
示例6: createUser
/**
* @Given /^que existen los siguientes usuarios:$/
*/
public function createUser(TableNode $tableNode)
{
foreach ($tableNode->getHash() as $userHash) {
$user = new User();
$user->setUsername($userHash['username']);
$user->setEmail($userHash['email']);
$user->setPlainPassword($userHash['plainPassword']);
$user->addRole($userHash['role']);
$this->getEntityManager()->persist($user);
$this->getEntityManager()->flush();
}
}
示例7: editAction
/**
* @param User $user
* @param Request $request
* @Route("/edit/{id}", name="admin_edit_user")
* @Template()
* @return \Symfony\Component\HttpFoundation\RedirectResponse
*/
public function editAction(User $user, Request $request)
{
$user->setPlainPassword('password');
$editForm = $this->createForm(UserEditType::class, $user);
$editForm->handleRequest($request);
if ($editForm->isValid()) {
$em = $this->getDoctrine()->getManager();
//$em->persist($user);
$em->flush();
return $this->redirectToRoute('show_all_users');
}
return ['user' => $user, 'form' => $editForm->createView()];
}
示例8: load
/**
* @param ObjectManager $manager
*
* @return $this
*/
public function load(ObjectManager $manager)
{
$admin = new User();
$admin->setUsername('admin');
$admin->setEmail('admin@cocoaco.de');
$admin->setSuperAdmin(true);
$admin->setEnabled(true);
$admin->setPlainPassword('admin');
$manager->persist($admin);
$manager->flush();
$this->addReference('admin-user', $admin);
return $this;
}
示例9: load
public function load(ObjectManager $manager)
{
$userPassword = 'siab';
$user = new User();
$user->setUsername($userPassword);
$user->setEmail('admin@mail.com');
$user->setFullName('super administrator');
$user->setRoles(array('ROLE_SUPER_ADMIN'));
$user->setPlainPassword($userPassword);
$user->setEnabled(true);
$manager->persist($user);
$manager->flush();
}
示例10: updateUserInfosWithLdap
/**
* @param User $user
*/
public function updateUserInfosWithLdap(User $user)
{
try {
$datas = $this->ldap->getDataByUid($user->getUsername());
$user->setFirstName($datas['givenname'][0]);
$user->setLastName($datas['sn'][0]);
$user->setEmail($datas['mail'][0]);
$user->setPlainPassword(md5(uniqid(rand(), true)));
$user->setPhoto(base64_encode($datas['jpegphoto'][0]));
} catch (\Exception $e) {
throw new UsernameNotFoundException(sprintf('Impossible de trouver %s dans le LDAP', $user->getUsername()));
}
}
示例11: createUser
public function createUser($username, array $roles, array $attributes)
{
$email = $username . '@uga.edu';
$password = substr($this->tokenGenerator->generateToken(), 0, 12);
$user = new User();
$user->setUsername($username);
$user->setUsernameCanonical($username);
$user->setEmail($email);
$user->setEmailCanonical($email);
$user->setEnabled(true);
$user->setPlainPassword($password);
$this->em->persist($user);
$this->em->flush();
return $user;
}
示例12: testAdd
public function testAdd()
{
$user = new User();
$user->setUsername('test');
$user->setEmail('test@unit.com');
$user->setPlainPassword('test');
$user->setEnabled(true);
$this->em->persist($user);
$this->em->flush();
/** @var User */
$userRetrieved = $this->em->getRepository('AppBundle:User')->createQueryBuilder('u')->andWhere('u.username = :username OR u.email = :email')->setParameter('username', 'test')->setParameter('email', 'test@unit.com')->getQuery()->getOneOrNullResult();
$this->assertInstanceOf('AppBundle\\Entity\\User', $user);
$this->assertEquals('test', $userRetrieved->getUsername());
$this->assertEquals('test@unit.com', $userRetrieved->getEmail());
}
示例13: testSubmitValidData
public function testSubmitValidData()
{
$formData = array('email' => 'test@user.com', 'username' => 'username', 'plainPassword' => 'plainPassword');
$form = $this->factory->create(UserType::class);
$object = new User();
$object->setEmail('test@user.com');
$object->setUsername('username');
$object->setPlainPassword('plainPassword');
$form->submit($formData);
$this->assertTrue($form->isSynchronized());
$view = $form->createView();
$children = $view->children;
foreach (array_keys($formData) as $key) {
$this->assertArrayHasKey($key, $children);
}
}
示例14: load
public function load(ObjectManager $manager)
{
foreach ($this->getAllUser() as $singleUser) {
$user = new User();
$user->setUsername($singleUser['username']);
$user->setPlainPassword($singleUser['PlainPassword']);
$user->setEmail($singleUser['Email']);
$user->setEnabled(true);
$user->addRole($singleUser['roles']);
$user->setName($singleUser['name']);
$user->setIsStaff($singleUser['isStaff']);
$user->setSiteId($this->getContainer()->get('doctrine.orm.entity_manager')->getRepository('AppBundle:Site')->findBy(array('url' => $singleUser['siteId'])));
$manager->persist($user);
}
$manager->flush();
}
示例15: generateUsers
/**
* @Given /^existen los siguientes usuarios:$/
*/
public function generateUsers(TableNode $usersTable)
{
$em = $this->getEntityManager();
foreach ($usersTable->getHash() as $userHash) {
$user = $this->getEntityManager()->getRepository('AppBundle:User')->findOneByUsername($userHash['nombre']);
if (!$user) {
$user = new User();
}
$user->setUsername($userHash['nombre']);
$user->setPlainPassword($userHash['clave']);
$user->setEmail($userHash['email']);
$user->setEnabled($userHash['activado']);
$user->addRole($userHash['rol']);
$em->persist($user);
}
$em->flush();
}