Пример #1
0
 /**
  * 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
 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;
 }