opensupports/server/controllers/user/check-session.php

38 lines
831 B
PHP
Raw Normal View History

<?php
2017-04-16 07:35:04 +02:00
/**
2017-04-17 04:59:11 +02:00
* @api {post} /user/check-session Check if session exist or not.
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-04-22 03:33:17 +02:00
* @apiDescription This path retrieves a object that says if a session exist or not.
2017-04-16 07:35:04 +02:00
*
* @apiPermission Any
*
2017-04-22 03:33:17 +02:00
* @apiSuccess {Object} data Information about the session
* @apiSuccess {Boolean} data.sessionActive Indicate if the session is activated
2017-04-16 07:35:04 +02:00
*
*/
class CheckSessionController extends Controller {
const PATH = '/check-session';
const METHOD = 'POST';
public function validations() {
return [
'permission' => 'any',
'requestData' => []
];
}
public function handler() {
$session = Session::getInstance();
Response::respondSuccess([
'sessionActive' => $session->sessionExists()
]);
}
}