From d1338cbb59d0752155f17d94b0b9b073df95183f Mon Sep 17 00:00:00 2001 From: George Halkiadakis Date: Sat, 27 May 2023 13:06:44 +0300 Subject: content model; add petition to database --- public/app/controllers/Auth.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'public/app/controllers/Auth.php') diff --git a/public/app/controllers/Auth.php b/public/app/controllers/Auth.php index e2fe989..9f440ed 100644 --- a/public/app/controllers/Auth.php +++ b/public/app/controllers/Auth.php @@ -136,7 +136,7 @@ class Auth { * setups and renders the form for a certain invitation * * NOTE: - * after form is submited, client calls Auth::activate() + * after form is submited, client shall call Auth::activate() * * @param $id (string|MD5) : invitation code * @@ -144,15 +144,13 @@ class Auth { public static function invitation($id) { // get user from invitation number - $user_array = Registry::use('database')->query( - "SELECT * FROM user WHERE invitation = :id", - ['id' => $id] - )->getFirst(); - if ($user_array == false) { + $user_array = Access_model::getUserByInvitation($id); + + if ($user_array == false) { // no invitation ? serve error then die; Render::view('error/404', ['moto' => 'Δεν βρέθηκε η πρόσκληση']); die(); } - $user = json_decode( json_encode($user_array, JSON_UNESCAPED_UNICODE)); // user in json format + $user = json_decode(json_encode($user_array, JSON_UNESCAPED_UNICODE)); // format form_setup to a json array $form_setup = json_decode(json_encode(REGISTRATION_FORM, JSON_UNESCAPED_UNICODE)); @@ -342,6 +340,8 @@ class Auth { public static function in_admin_group() { + if (!self::is_connected()) return false; + $manager = new App_manager(); return ($manager->isGranted([1, 2, 3])); } -- cgit v1.2.3