當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。