From ac0364d9e688f004bf52e1fb9a7f00a21c8ce32d Mon Sep 17 00:00:00 2001 From: Josh Crawford Date: Mon, 15 Jul 2024 14:54:45 +1000 Subject: [PATCH] Revert callback URI change for `cpTrigger = null` (for detached CPs) --- src/SocialLogin.php | 2 +- src/base/OAuthProvider.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/SocialLogin.php b/src/SocialLogin.php index 099308b..045fb36 100644 --- a/src/SocialLogin.php +++ b/src/SocialLogin.php @@ -86,7 +86,7 @@ private function _registerCpRoutes(): void $event->rules['social-login/settings/providers'] = 'social-login/providers'; $event->rules['social-login/settings/providers/edit/'] = 'social-login/providers/edit'; - if (Craft::$app->getConfig()->getGeneral()->headlessMode || !Craft::$app->getConfig()->getGeneral()->cpTrigger) { + if (Craft::$app->getConfig()->getGeneral()->headlessMode) { $event->rules['social-login/auth/callback'] = 'social-login/auth/callback'; } }); diff --git a/src/base/OAuthProvider.php b/src/base/OAuthProvider.php index 25f856d..d1d6f2a 100644 --- a/src/base/OAuthProvider.php +++ b/src/base/OAuthProvider.php @@ -56,8 +56,8 @@ public function getRedirectUri(): ?string $siteId = Craft::$app->getSites()->getCurrentSite()->id ?? Craft::$app->getSites()->getPrimarySite()->id; - // Check for Headless Mode and use the Action URL, or when `cpTrigger` is empty to signify split front/back-end - if ($generalConfig->headlessMode || !$generalConfig->cpTrigger) { + // Check for Headless Mode and use the Action URL + if ($generalConfig->headlessMode) { // Don't use the `cpUrl` or `actionUrl` helpers, which include the `cpTrigger`, and that won't work when // trying to login via the CP. Instead, use the action endpoint, but manually constructed. return rtrim(UrlHelper::baseCpUrl(), '/') . '/' . rtrim($generalConfig->actionTrigger, '/') . '/social-login/auth/callback';