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