diff options
Diffstat (limited to 'public/app/controllers/Auth.php')
| -rw-r--r-- | public/app/controllers/Auth.php | 14 |
1 files changed, 7 insertions, 7 deletions
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])); } |
