Exemple #1
0
 /**
  * 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());
 }
Exemple #2
0
 /**
  * @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);
 }