From 871cbab278bf6efa57d8e2c9853bc1f1f7d819e1 Mon Sep 17 00:00:00 2001 From: Nikolas Goerlitz Date: Wed, 26 Jun 2024 15:01:14 +0200 Subject: [PATCH] Enable callback --- VATGER/Auth/Pub/Controller/ConnectController.php | 11 +++++++---- VATGER/Auth/_data/options.xml | 4 ++++ VATGER/Auth/_data/phrases.xml | 2 ++ VATGER/Auth/_data/templates.xml | 4 ++-- VATGER/Auth/_output/options/_metadata.json | 3 +++ VATGER/Auth/_output/phrases/_metadata.json | 12 ++++++++++++ VATGER/Auth/_output/templates/_metadata.json | 6 +++--- VATGER/Auth/addon.json | 4 ++-- 8 files changed, 35 insertions(+), 11 deletions(-) diff --git a/VATGER/Auth/Pub/Controller/ConnectController.php b/VATGER/Auth/Pub/Controller/ConnectController.php index 3d0e6dc..00f392c 100644 --- a/VATGER/Auth/Pub/Controller/ConnectController.php +++ b/VATGER/Auth/Pub/Controller/ConnectController.php @@ -64,7 +64,7 @@ public function actionCallback() // Find the first available username $count = 1; $fullDBName = $fullName; - while (\XF::finder('XF:User')->where('username', $fullDBName)->total() > 0) { + while (\XF::finder('XF:User')->where('username', $fullDBName)->fetch()->count() > 0) { $fullDBName = $fullName . ' ' . $count; $count++; } @@ -95,13 +95,16 @@ public function actionCallback() try { \XF::app()->http()->client()->post($this->options()['homepage_callback'], [ 'json' => [ - 'cid' => $cid, + 'vatsim_id' => $cid, 'forum_id' => $baseUser['user_id'] + ], + 'headers' => [ + 'Authorization' => 'Token ' . $this->options()['homepage_token'] ] ]); } catch (\Exception $exception) { - // $baseUser->delete(); - // return $this->error(self::$GENERIC_ERROR_MESSAGE, $exception->getMessage()); + $baseUser->delete(); + return $this->error(self::$GENERIC_ERROR_MESSAGE, $exception->getMessage()); } } diff --git a/VATGER/Auth/_data/options.xml b/VATGER/Auth/_data/options.xml index 8dabec8..09fe3af 100644 --- a/VATGER/Auth/_data/options.xml +++ b/VATGER/Auth/_data/options.xml @@ -24,6 +24,10 @@ +