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


PHP UserInterface::getPassword方法代码示例

本文整理汇总了PHP中FOS\UserBundle\Model\UserInterface::getPassword方法的典型用法代码示例。如果您正苦于以下问题:PHP UserInterface::getPassword方法的具体用法?PHP UserInterface::getPassword怎么用?PHP UserInterface::getPassword使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FOS\UserBundle\Model\UserInterface的用法示例。


在下文中一共展示了UserInterface::getPassword方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: updateUserByOAuthUserResponse

 /**
  * Attach OAuth sign-in provider account to existing user
  *
  * @param FOSUserInterface      $user
  * @param UserResponseInterface $response
  *
  * @return FOSUserInterface
  */
 protected function updateUserByOAuthUserResponse(FOSUserInterface $user, UserResponseInterface $response)
 {
     $providerName = $response->getResourceOwner()->getName();
     $providerNameSetter = 'set' . ucfirst($providerName) . 'Id';
     $user->{$providerNameSetter}($response->getUsername());
     if (!$user->getPassword()) {
         // generate unique token
         $secret = md5(uniqid(rand(), true));
         $user->setPassword($secret);
     }
     return $user;
 }
开发者ID:MadeWilson,项目名称:protoStage,代码行数:20,代码来源:UserProvider.php

示例2: updateUserByOAuthUserResponse

 /**
  * Attach OAuth sign-in provider account to existing user
  *
  * @param FOSUserInterface      $user
  * @param UserResponseInterface $response
  *
  * @return FOSUserInterface
  */
 protected function updateUserByOAuthUserResponse(FOSUserInterface $user, UserResponseInterface $response)
 {
     $providerName = $response->getResourceOwner()->getName();
     $providerNameSetter = 'set' . ucfirst($providerName) . 'Id';
     $user->{$providerNameSetter}($response->getUsername());
     /** Is for accept OAuth connexion without password **/
     if (!$user->getPassword()) {
         $secret = md5(uniqid(rand(), true));
         $user->setPassword($secret);
     }
     return $user;
 }
开发者ID:rkueny,项目名称:sf-start,代码行数:20,代码来源:UserProvider.php

示例3: userLoginAction

 /**
  * add the symfony-login "manually".
  * 
  * use the symfony token-storage for the generated UsernamePasswordToken 
  * to access the (logged in) user later (e.g. to check for roles or permissions)
  * 
  * the given $passwordHash must match the encrypted password in the user-object
  * 
  * before and after the generation/setting of the token, the events "secotrust.user_login.before" 
  * and "secotrust.user_login.after" are called, if some EventListeners are configured
  *
  * @param \FOS\UserBundle\Model\UserInterface $user
  * @param $passwordHash
  */
 private function userLoginAction(\FOS\UserBundle\Model\UserInterface $user, $passwordHash)
 {
     // call the pre-login-event
     $event = new Event();
     $this->dispatcher->dispatch('secotrust.user_login.before', $event);
     if ($user->getPassword() !== $passwordHash) {
         // stop the login-action, when the password doesn't match
         return;
     }
     $token = new UsernamePasswordToken($user, null, 'secured_area', $user->getRoles());
     $this->token_storage->setToken($token);
     // call the post-login-event
     $event = new Event();
     $this->dispatcher->dispatch('secotrust.user_login.after', $event);
 }
开发者ID:bartv2,项目名称:SecotrustSabreDavBundle,代码行数:29,代码来源:AuthBackend.php


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