From 8ca881110b15be07d33ff9db8bf3126420d0e966 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Thu, 28 Oct 2021 13:59:04 +0200 Subject: [PATCH] The authorization class works with the accounts library (work in progress). --- engine/Api/V1/Authorization.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/engine/Api/V1/Authorization.php b/engine/Api/V1/Authorization.php index f510ceb4..c8095570 100644 --- a/engine/Api/V1/Authorization.php +++ b/engine/Api/V1/Authorization.php @@ -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'); } } }