From 463139601c046a5201cb8a73473f8fe5c568b760 Mon Sep 17 00:00:00 2001 From: George Halkiadakis Date: Thu, 27 Apr 2023 20:15:02 +0300 Subject: rearangment completed; now anything is simplel --- public/app/controllers/Auth.php | 15 +++++++-------- public/app/controllers/CmsAdmin.php | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-) (limited to 'public/app/controllers') diff --git a/public/app/controllers/Auth.php b/public/app/controllers/Auth.php index aeec41c..4b3dcfb 100644 --- a/public/app/controllers/Auth.php +++ b/public/app/controllers/Auth.php @@ -7,10 +7,9 @@ use Render; // user classes and models use app\extends\Classroom_user; use app\extends\Classroom_manager; -use app\models\User_model; +use app\models\Access_model; +use app\extends\SendMail_service; -use app\extends\Send_mail; -use app\extends\Mail_jet; /** class Auth @@ -31,7 +30,7 @@ class Auth { $req = Registry::get('REQUEST'); // get the record of the target user - $record = User_model::checkUser($req->POST['email']); + $record = Access_model::checkUser($req->POST['email']); // if no user exists, return false if ($record === false) return false; @@ -51,7 +50,7 @@ class Auth { if ($userManager->isPasswordValid($user, $req->POST['password'])) { // get user's security attributes - $attributes = User_Model::getUser($record['id']); + $attributes = Access_model::getUser($record['id']); $roles = json_decode($attributes['Roles_json']); $user ->setRoles($roles) @@ -111,7 +110,7 @@ class Auth { $req = Registry::get('REQUEST'); // get the record of the target user - $check = User_model::activate($req->GET['ticket']); + $check = Access_model::activate($req->GET['ticket']); if ($check == true) { Render::view('/error/general', [ @@ -151,7 +150,7 @@ class Auth { ->setPrivileges([]); // none privilege until acount confirmation // create user record - $activation_code = User_model::registerUser($req->POST, $password); + $activation_code = Access_model::registerUser($req->POST, $password); // TODO: // handle error on user registration @@ -164,7 +163,7 @@ class Auth { // ]; // } - $send_mail = Send_mail::send_activation_code([ + $send_mail = SendMail_service::send_activation_code([ 'email' => $req->POST['email'], 'name' => $req->POST['name'] .' '. $req->POST['surname'], 'code' => $activation_code['activation'] diff --git a/public/app/controllers/CmsAdmin.php b/public/app/controllers/CmsAdmin.php index aa6ff6f..9629741 100644 --- a/public/app/controllers/CmsAdmin.php +++ b/public/app/controllers/CmsAdmin.php @@ -1,6 +1,6 @@