コード例 #1
0
ファイル: ControllerTestCase.php プロジェクト: zfury/cmf
 /**
  * Authorizes user.
  *
  * @param \User\Entity\User $user
  */
 protected function loginUser(Entity\User $user)
 {
     /** @var \User\Entity\Auth $userAuth */
     $userAuth = new Entity\Auth();
     $userAuth->setUserId($user->getId());
     $userAuth->setProvider(Auth::PROVIDER_EQUALS);
     $userAuth->setUser($user);
     $userAuth->login($this->getApplicationServiceLocator());
 }
コード例 #2
0
ファイル: Auth.php プロジェクト: zfury/cmf
 /**
  * @param \User\Entity\Auth $auth
  * @param $password
  * @return string
  */
 public static function encrypt(\User\Entity\Auth $auth, $password)
 {
     $bcrypt = new Bcrypt();
     $bcrypt->setSalt($auth->getTokenSecret());
     return $bcrypt->create($password);
 }