本文整理汇总了PHP中AppBundle\Entity\User::getPassword方法的典型用法代码示例。如果您正苦于以下问题:PHP User::getPassword方法的具体用法?PHP User::getPassword怎么用?PHP User::getPassword使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppBundle\Entity\User
的用法示例。
在下文中一共展示了User::getPassword方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: authenticate
/**
* 认证用户
*/
public function authenticate(User $user, $providerKey)
{
$authenticationToken = new UsernamePasswordToken($user, $user->getPassword(), $providerKey, $user->getRoles());
$authenticationEvent = new InteractiveLoginEvent($this->request, $authenticationToken);
$this->tokenStorage->setToken($authenticationToken);
$this->dispatcher->dispatch(SecurityEvents::INTERACTIVE_LOGIN, $authenticationEvent);
}
示例2: testBasicGettersSetters
public function testBasicGettersSetters()
{
$user = new User();
$user->setUsername('Toto');
$user->setEmail('toto@tata.com');
$user->setIsActive(false);
$user->setPassword('1234');
$this->assertEquals('Toto', $user->getUsername());
$this->assertEquals('toto@tata.com', $user->getEmail());
$this->assertEquals(false, $user->isActive());
$this->assertEquals('1234', $user->getPassword());
}
示例3: __construct
/**
* UserModel constructor.
* @param User $user
*/
public function __construct(User $user)
{
$this->setId($user->getId());
$this->setUsername($user->getUsername());
$this->setUserFirstName($user->getUserFirstName());
$this->setUserLastName($user->getUserLastName());
$this->setEmail($user->getEmail());
$this->setPassword($user->getPassword());
$this->setApiKey($user->getApiKey());
$role = $this->determineTheBiggestRole($user);
if ($role) {
$this->setRole(new RoleModel($role));
}
}
示例4: editAction
/**
* @param User $user
* @param Request $request
*
* @return Response
*
* @Route("/{id}", name="app_users_edit", requirements={"id": "^\d+$"}, methods={"GET", "POST"})
* @Security("has_role('ROLE_AUTH_USERS_EDIT')")
*/
public function editAction(User $user, Request $request)
{
$originalPassword = $user->getPassword();
$form = $this->get('form.factory')->create(UserType::class, $user, ['delete' => $this->isUserDeletable($user), 'activate' => $this->isUserActivate($user)]);
if ($form->handleRequest($request) && $form->isValid()) {
$manager = $this->get('doctrine.orm.entity_manager');
// Delete section
if ($form->has('delete') && $form->get('delete')->isClicked()) {
$manager->remove($user);
$manager->flush();
$this->get('session')->getFlashBag()->add('notice', $this->get('translator')->trans('users.message.delete'));
return new RedirectResponse($this->generateUrl('app_users_list'));
}
$this->get('app.password')->encodePassword($user, $originalPassword);
$manager->flush();
$this->get('session')->getFlashBag()->add('notice', $this->get('translator')->trans('users.message.edit'));
}
return $this->render('users/edit.html.twig', ['form' => $form->createView()]);
}
示例5: getPassword
/**
* {@inheritDoc}
*/
public function getPassword()
{
$this->__initializer__ && $this->__initializer__->__invoke($this, 'getPassword', []);
return parent::getPassword();
}
示例6: fromUser
public function fromUser(User $user)
{
$userContract = new self();
//Force fetch
$user->getMyContacts()->toArray();
$user->getConversations()->toArray();
$user->getContactsWithMe()->toArray();
$userContract->id = $user->getId();
$userContract->tkey = $user->getTkey();
$userContract->avatar = $user->getAvatar();
$userContract->birthday = $user->getBirthday();
$userContract->cdate = $user->getCdate();
$userContract->conversations = $user->getConversations();
$userContract->connections = $user->getConnections();
$userContract->contactsphones = $user->getContactsphones();
$userContract->email = $user->getEmail();
$userContract->fname = $user->getFname();
$userContract->lastUpdate = $user->getLastUpdate();
$userContract->lname = $user->getLname();
$userContract->contactsWithMe = $user->getContactsWithMe();
$user->getMyContacts()->toArray();
$userContract->myContacts = $user->getMyContacts();
$userContract->password = $user->getPassword();
$userContract->phone = $user->getPhone();
$userContract->username = $user->getUsername();
return $userContract;
}
示例7: loginUser
/**
* Logs this user into the system
*
* @param User $user
*/
public function loginUser(User $user)
{
$token = new UsernamePasswordToken($user, $user->getPassword(), 'main', $user->getRoles());
$this->container->get('security.token_storage')->setToken($token);
}
示例8: createUser
/**
* @param User $user
*
* @return UserDTO
*/
public function createUser(User $user)
{
if ($user->getPositionLat() . $user->getPositionLong() != "") {
$infos = Geocoder::getLocation($user->getPositionLat(), $user->getPositionLong());
$city = Geocoder::getCityFromAddress($infos);
$department = Geocoder::getDepartmentFromAddress($infos);
$country = Geocoder::getCountryFromAddress($infos);
$user->setPositionCity($city);
$user->setPositionDep($department);
$user->setPositionCountry($country);
}
$user->setPassword(sha1($user->getPassword()));
if ($user->getPhoto() == "") {
$user->setPhoto("https://randomuser.me/api/portraits/med/men/54.jpg");
}
$this->em->persist($user);
$this->em->flush();
return new UserDTO($user);
}
示例9: login
private function login(User $user, $client)
{
// dummy call to bypass the hasPreviousSession check
$crawler = $client->request('GET', '/');
$firewall = 'main';
$token = new UsernamePasswordToken($user, $user->getPassword(), $firewall, $user->getRoles());
$session = $client->getContainer()->get('session');
$session->set('_security_' . $firewall, serialize($token));
$session->save();
}