You are here

public function RestfulUserLoginCookie::loginAndRespondWithCookie in RESTful 7

Login a user and return a JSON along with the authentication cookie.

Return value

array Array with the public fields populated.

File

plugins/restful/user/login_cookie/1.0/RestfulUserLoginCookie.class.php, line 27
Contains RestfulUserLoginCookie.

Class

RestfulUserLoginCookie
@file Contains RestfulUserLoginCookie.

Code

public function loginAndRespondWithCookie() {

  // Login the user.
  $account = $this
    ->getAccount();
  $this
    ->loginUser();
  $version = $this
    ->getVersion();
  $handler = restful_get_restful_handler('users', $version['major'], $version['minor']);
  $output = $handler ? $handler
    ->viewEntity($account->uid) : array();
  $output += restful_csrf_session_token();
  return $output;
}