コード例 #1
0
ファイル: Jwt.php プロジェクト: fluxoft/rebar
 /**
  * Attempt to log the user in using the given $username and $password
  * and return a Reply object.
  * @param string $username
  * @param string $password
  * @return \Fluxoft\Rebar\Auth\Reply
  */
 public function Login($username, $password)
 {
     $reply = new Reply();
     $user = $this->userMapper->GetAuthorizedUserForUsernameAndPassword($username, $password);
     if ($user instanceof UserInterface) {
         $tokenString = $this->getTokenString($user);
         $reply->Auth = true;
         $reply->User = $user;
         $reply->Token = $tokenString;
         $this->auth = $reply;
     } else {
         $reply->Message = 'User not found';
     }
     return $reply;
 }
コード例 #2
0
ファイル: Web.php プロジェクト: fluxoft/rebar
 public function Login($username, $password, $remember = false)
 {
     $reply = new Reply();
     $user = $this->userMapper->GetAuthorizedUserForUsernameAndPassword($username, $password);
     if ($user instanceof UserInterface) {
         $tokenString = $this->setTokens($user, null, $remember);
         $reply->Auth = true;
         $reply->User = $user;
         $reply->Token = $tokenString;
         $this->auth = $reply;
     }
     return $reply;
 }