rememberUser() public method

public rememberUser ( Psr\Http\Message\ResponseInterface $response, $userId )
$response Psr\Http\Message\ResponseInterface
 public function make(Request $request, array $identification, array $suggestions = [])
 {
     if (isset($suggestions['username'])) {
         $suggestions['username'] = $this->sanitizeUsername($suggestions['username']);
     }
     $user = User::where($identification)->first();
     $payload = $this->getPayload($identification, $suggestions, $user);
     $response = $this->getResponse($payload);
     if ($user) {
         $session = $request->getAttribute('session');
         $this->authenticator->logIn($session, $user->id);
         $response = $this->rememberer->rememberUser($response, $user->id);
     }
     return $response;
 }
Beispiel #2
0
 /**
  * @param Request $request
  * @return JsonResponse
  */
 public function handle(Request $request)
 {
     $controller = 'Flarum\\Api\\Controller\\CreateUserController';
     $actor = $request->getAttribute('actor');
     $body = ['data' => ['attributes' => $request->getParsedBody()]];
     $response = $this->api->send($controller, $actor, [], $body);
     $body = json_decode($response->getBody());
     if (isset($body->data)) {
         $userId = $body->data->id;
         $session = $request->getAttribute('session');
         $this->authenticator->logIn($session, $userId);
         $response = $this->rememberer->rememberUser($response, $userId);
     }
     return $response;
 }