diff --git a/application/controllers/api/v1/CheckUserAuth.php b/application/controllers/api/v1/CheckUserAuth.php new file mode 100644 index 000000000..a793845a7 --- /dev/null +++ b/application/controllers/api/v1/CheckUserAuth.php @@ -0,0 +1,44 @@ +load->model('CheckUserAuth_model', 'CheckUserAuthModel'); + } + + public function getCheckByUsernamePassword() + { + $username = $this->get("username"); + $password = $this->get("password"); + + if (isset($username) && isset($password)) + { + $result = $this->CheckUserAuthModel->checkByUsernamePassword($username, $password); + + $this->response($result, REST_Controller::HTTP_OK); + } + else + { + $this->response(); + } + } +} \ No newline at end of file diff --git a/application/libraries/FHC_Auth.php b/application/libraries/FHC_Auth.php index 255ff6b1d..17cfd65f6 100644 --- a/application/libraries/FHC_Auth.php +++ b/application/libraries/FHC_Auth.php @@ -26,8 +26,16 @@ require_once FCPATH.'include/AddonAuthentication.php'; // ------------------------------------------------------------------------ -class FHC_Auth +class FHC_Auth extends authentication { + /** + * Construct + */ + public function __construct() + { + parent::__construct(); + } + /** * Auth Username, Password over FH-Complete * @@ -37,8 +45,7 @@ class FHC_Auth */ public function basicAuthentication($username, $password) { - $auth = new authentication(); - if ($auth->checkpassword($username, $password)) + if ($this->checkpassword($username, $password)) { return true; } @@ -49,6 +56,9 @@ class FHC_Auth } /** + * + * TO BE UPDATED + * * Get the md5 hashed password by the addon username * * @param string $username addon username diff --git a/application/models/CheckUserAuth_model.php b/application/models/CheckUserAuth_model.php new file mode 100644 index 000000000..acf9c3723 --- /dev/null +++ b/application/models/CheckUserAuth_model.php @@ -0,0 +1,18 @@ +load->library('fhc_auth'); + } + + public function checkByUsernamePassword($username, $password) + { + return $this->_success($this->fhc_auth->checkpassword($username, $password)); + } +} \ No newline at end of file