function RestAuthenticationController::loginStatus
Same name and namespace in other branches
- main core/modules/rest/src/Controller/RestAuthenticationController.php \Drupal\rest\Controller\RestAuthenticationController::loginStatus()
Checks whether a user is logged in or not.
Return value
\Symfony\Component\HttpFoundation\Response The response.
1 string reference to 'RestAuthenticationController::loginStatus'
- rest.routing.yml in core/
modules/ rest/ rest.routing.yml - core/modules/rest/rest.routing.yml
File
-
core/
modules/ rest/ src/ Controller/ RestAuthenticationController.php, line 273
Class
- RestAuthenticationController
- Provides controllers for login, login status and logout via HTTP requests.
Namespace
Drupal\rest\ControllerCode
public function loginStatus() : Response {
if ($this->currentUser()
->isAuthenticated()) {
$response = new Response(self::LOGGED_IN);
}
else {
$response = new Response(self::LOGGED_OUT);
}
$response->headers
->set('Content-Type', 'text/plain');
return $response;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.