/** * 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()); }
/** * @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); }