mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-24 02:12:17 +00:00
- Removed method getCheckUserAuth form api/v1/CheckUserAuth
- Changed LDAP_Model to a library: LDAPLib - Removed controller system/Login AuthLib: - Added new private method _createAuthObjByPerson - Moved config load from constructor to _authenticate - Moved Person_Model load from constructor to _createAuthObjByPerson - Removed method checkUserAuthByCode - Removed method checkUserAuthByCodeEmail - Adapted code to use LDAPLib
This commit is contained in:
@@ -35,45 +35,4 @@ class CheckUserAuth extends REST_Controller
|
||||
$this->response();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if username and password of a final user are valid
|
||||
* Returns all the keys with which is possible to obtain all the personal data about a final user
|
||||
*/
|
||||
public function getCheckUserAuth()
|
||||
{
|
||||
$code = $this->get('code');
|
||||
$email = $this->get('email');
|
||||
$username = $this->get('username');
|
||||
$password = $this->get('password');
|
||||
|
||||
$result = null;
|
||||
$httpCode = null;
|
||||
|
||||
// If username and password are given then check authentication using them
|
||||
if (isset($username) && isset($password))
|
||||
{
|
||||
$result = $this->authlib->checkUserAuthByUsernamePassword($username, $password, true);
|
||||
}
|
||||
elseif (isset($code) || isset($email))
|
||||
{
|
||||
// If code and email are given then check authentication using them
|
||||
if (isset($code) && isset($email))
|
||||
{
|
||||
$result = $this->authlib->checkUserAuthByCodeEmail($code, $email);
|
||||
}
|
||||
else // otherwise check authentication using only code
|
||||
{
|
||||
$result = $this->authlib->checkUserAuthByCode($code);
|
||||
}
|
||||
}
|
||||
|
||||
// If is a success and contains data
|
||||
if (hasData($result))
|
||||
{
|
||||
$httpCode = REST_Controller::HTTP_OK;
|
||||
}
|
||||
|
||||
$this->response($result, $httpCode);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user