mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-11-28 10:53:40 +03:00
The authorization class works with the accounts library (work in progress).
This commit is contained in:
parent
5e4bf0bd22
commit
8ca881110b
1 changed files with 4 additions and 4 deletions
|
@ -48,15 +48,15 @@ class Authorization {
|
|||
* @param NonEmptyText $username Admin Username
|
||||
* @param NonEmptyText $password Admin Password
|
||||
*
|
||||
* @throws \EA\Engine\Api\V1\Exception Throws 401-Unauthorized exception if the authentication fails.
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
public function basic(NonEmptyText $username, NonEmptyText $password)
|
||||
{
|
||||
$this->CI->load->model('user_model');
|
||||
$this->CI->load->library('accounts');
|
||||
|
||||
if ( ! $this->CI->user_model->check_login($username->get(), $password->get()))
|
||||
if ( ! $this->CI->accounts->check_login($username->get(), $password->get()))
|
||||
{
|
||||
throw new Exception('The provided credentials do not match any admin user!', 401, 'Unauthorized');
|
||||
throw new \RuntimeException('The provided credentials do not match any admin user!', 401, 'Unauthorized');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue