Files
FHC-Core/application/controllers/api/v1/CheckUserAuth.php
T
Paolo d2e8b01e30 - codeigniter-restserver is now provided and loaded via composer (libraries/REST_Controller.php, config/rest.php, language/english/rest_controller_lang.php, libraries/Format.php, etc)
- Added new core controller core/RESTFul_Controller.php that extends REST_Controller and partially overrides part of the latter
- Changed application/config/rest.php to keep the minimal useful set of configs
- Controllers core/APIv1_Controller, controllers/api/v1/CheckUserAuth.php and controllers/api/v1/Test.php now extend core/RESTFul_Controller
- Changed method _remap interface for core/APIv1_Controller
- Removed application/core/REST_Controller.php
- Removed application/libraries/Format.php
- Removed application/language/english/rest_controller_lang.php
2019-07-31 14:46:31 +02:00

39 lines
834 B
PHP

<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
class CheckUserAuth extends RESTFul_Controller
{
/**
* Course API constructor.
*/
public function __construct()
{
parent::__construct();
// Loads helper message to manage returning messages
// NOTE: loaded here because it does not extend the APIv1_Controller
$this->load->helper('hlp_return_object');
}
/**
* Checks if username and password of a final user are valid
*/
public function getCheckByUsernamePassword()
{
$username = $this->get('username');
$password = $this->get('password');
if (isset($username) && isset($password))
{
$result = $this->authlib->checkUserAuthByUsernamePassword($username, $password);
$this->response($result, REST_Controller::HTTP_OK);
}
else
{
$this->response();
}
}
}