当前位置: 首页>>代码示例>>PHP>>正文


PHP User::setPlainPassword方法代码示例

本文整理汇总了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;
 }
开发者ID:OpenSkills,项目名称:skillsprofile,代码行数:28,代码来源:MyFOSUBUserProvider.php

示例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);
 }
开发者ID:richardlawson,项目名称:coinflip,代码行数:36,代码来源:LoadUserData.php

示例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);
 }
开发者ID:Algatux,项目名称:symfony3.0,代码行数:11,代码来源:LoadUserData.php

示例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);
 }
开发者ID:jasongrimes,项目名称:stressmonkey,代码行数:11,代码来源:LoadUserData.php

示例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();
 }
开发者ID:vitor-silva,项目名称:symfony-playground,代码行数:14,代码来源:LoadUserData.php

示例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();
     }
 }
开发者ID:aulasoftwarelibre,项目名称:ritsiga,代码行数:15,代码来源:UserContext.php

示例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()];
 }
开发者ID:maximzh,项目名称:Blog,代码行数:20,代码来源:UserController.php

示例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;
 }
开发者ID:staegi,项目名称:symfony-rest-api,代码行数:18,代码来源:UserData.php

示例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();
 }
开发者ID:mrcoco,项目名称:Skeleton,代码行数:13,代码来源:LoadUserData.php

示例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()));
     }
 }
开发者ID:sghribi,项目名称:garopi,代码行数:16,代码来源:UserService.php

示例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;
 }
开发者ID:rlbaltha,项目名称:cert,代码行数:15,代码来源:SSOUserProvider.php

示例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());
 }
开发者ID:vitor-silva,项目名称:symfony-playground,代码行数:15,代码来源:UserTest.php

示例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);
     }
 }
开发者ID:syrotchukandrew,项目名称:rainbow,代码行数:16,代码来源:UserTypeTest.php

示例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();
 }
开发者ID:johnmackenzie91,项目名称:ClientDocumentArea,代码行数:16,代码来源:LoadUserData.php

示例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();
 }
开发者ID:jmibla,项目名称:sgcl,代码行数:20,代码来源:UserContext.php


注:本文中的AppBundle\Entity\User::setPlainPassword方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。