mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-16 22:42:16 +00:00
Added new public method loginLDAP to AuthLib
This commit is contained in:
@@ -154,6 +154,39 @@ class AuthLib
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Login a user with the given username and password using LDAP
|
||||
*/
|
||||
public function loginLDAP($username, $password)
|
||||
{
|
||||
$loginUP = $this->_checkLDAPAuthentication($username, $password);
|
||||
if (isSuccess($loginUP))
|
||||
{
|
||||
$this->_ci->PersonModel->resetQuery(); // Reset an eventually already built query
|
||||
|
||||
// Retrieves user data from DB using the UID
|
||||
$personResult = $this->_ci->PersonModel->getByUid($username);
|
||||
if (hasData($personResult))
|
||||
{
|
||||
$person = getData($personResult)[0];
|
||||
|
||||
// Stores used data into the authentication object and then into a success object
|
||||
$loginUP = success(
|
||||
$this->_createAuthObj($person->person_id, $person->vorname, $person->nachname, $username),
|
||||
AUTH_SUCCESS
|
||||
);
|
||||
|
||||
$this->_storeAuthObj(getData($loginUP));
|
||||
}
|
||||
elseif (isError($personResult)) // blocking error
|
||||
{
|
||||
$loginUP = $personResult; // to be displayed
|
||||
}
|
||||
}
|
||||
|
||||
return $loginUP;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Private methods
|
||||
|
||||
|
||||
Reference in New Issue
Block a user