2016-07-20 06:31:07 +02:00
|
|
|
<?php
|
|
|
|
|
2017-04-16 07:35:04 +02:00
|
|
|
/**
|
2017-05-12 06:58:40 +02:00
|
|
|
* @api {post} /user/check-session Check session
|
2021-10-19 03:06:20 +02:00
|
|
|
* @apiVersion 4.10.0
|
2017-04-16 07:35:04 +02:00
|
|
|
*
|
2017-04-21 08:09:24 +02:00
|
|
|
* @apiName Check session
|
2017-04-16 07:35:04 +02:00
|
|
|
*
|
|
|
|
* @apiGroup User
|
|
|
|
*
|
2017-05-12 06:58:40 +02:00
|
|
|
* @apiDescription This path checks if the session exists.
|
2017-04-16 07:35:04 +02:00
|
|
|
*
|
2017-05-12 06:58:40 +02:00
|
|
|
* @apiPermission any
|
2017-04-16 07:35:04 +02:00
|
|
|
*
|
2017-05-12 06:58:40 +02:00
|
|
|
* @apiSuccess {Object} data Information about the session.
|
|
|
|
* @apiSuccess {Boolean} data.sessionActive Indicates if the session is active.
|
2017-04-16 07:35:04 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2016-07-20 06:31:07 +02:00
|
|
|
class CheckSessionController extends Controller {
|
|
|
|
const PATH = '/check-session';
|
2017-02-08 19:09:15 +01:00
|
|
|
const METHOD = 'POST';
|
2016-07-20 06:31:07 +02:00
|
|
|
|
|
|
|
public function validations() {
|
|
|
|
return [
|
|
|
|
'permission' => 'any',
|
|
|
|
'requestData' => []
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
public function handler() {
|
|
|
|
$session = Session::getInstance();
|
|
|
|
|
|
|
|
Response::respondSuccess([
|
|
|
|
'sessionActive' => $session->sessionExists()
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|