diff --git a/src/config/GeneralConfig.php b/src/config/GeneralConfig.php index c27de232412..758834438be 100644 --- a/src/config/GeneralConfig.php +++ b/src/config/GeneralConfig.php @@ -1690,8 +1690,6 @@ class GeneralConfig extends BaseConfig * * This can be set to `false` to disable front-end login. * - * Note that this config setting is ignored when is enabled. - * * See [[ConfigHelper::localizedValue()]] for a list of supported value types. * * ::: code @@ -1713,8 +1711,6 @@ class GeneralConfig extends BaseConfig * * This can be set to `false` to disable front-end logout. * - * Note that this config setting is ignored when is enabled. - * * See [[ConfigHelper::localizedValue()]] for a list of supported value types. * * ::: code @@ -2745,8 +2741,6 @@ class GeneralConfig extends BaseConfig /** * @var mixed The URI or URL that Craft should use for Set Password forms on the front end. * - * This setting is ignored when is enabled, unless it’s set to an absolute URL. - * * See [[ConfigHelper::localizedValue()]] for a list of supported value types. * * ::: tip @@ -3311,8 +3305,6 @@ class GeneralConfig extends BaseConfig /** * @var mixed The URI or URL that Craft should use for email verification links on the front end. * - * This setting is ignored when is enabled, unless it’s set to an absolute URL. - * * See [[ConfigHelper::localizedValue()]] for a list of supported value types. * * ::: code @@ -5167,8 +5159,6 @@ public function localeAliases(array $value): self * * This can be set to `false` to disable front-end login. * - * Note that this config setting is ignored when is enabled. - * * See [[ConfigHelper::localizedValue()]] for a list of supported value types. * * ```php @@ -5192,8 +5182,6 @@ public function loginPath(mixed $value): self * * This can be set to `false` to disable front-end logout. * - * Note that this config setting is ignored when is enabled. - * * See [[ConfigHelper::localizedValue()]] for a list of supported value types. * * ```php @@ -6374,8 +6362,6 @@ public function sendPoweredByHeader(bool $value = true): self /** * The URI or URL that Craft should use for Set Password forms on the front end. * - * This setting is ignored when is enabled, unless it’s set to an absolute URL. - * * See [[ConfigHelper::localizedValue()]] for a list of supported value types. * * ::: tip @@ -7018,8 +7004,6 @@ public function verificationCodeDuration(mixed $value): self /** * The URI or URL that Craft should use for email verification links on the front end. * - * This setting is ignored when is enabled, unless it’s set to an absolute URL. - * * See [[ConfigHelper::localizedValue()]] for a list of supported value types. * * ```php diff --git a/src/controllers/UsersController.php b/src/controllers/UsersController.php index aab944d09fe..e41918abf1f 100644 --- a/src/controllers/UsersController.php +++ b/src/controllers/UsersController.php @@ -202,6 +202,11 @@ public function beforeAction($action): bool */ public function actionLogin(): ?Response { + // Set the default response format to HTML, in case it was set to JSON for headless mode + if (!$this->request->getAcceptsJson()) { + $this->response->format = Response::FORMAT_HTML; + } + if ($this->request->getIsGet()) { // see if they're already logged in $user = static::currentUser(); @@ -577,6 +582,11 @@ public function actionGetElevatedSessionTimeout(): Response */ public function actionLogout(): Response { + // Set the default response format to HTML, in case it was set to JSON for headless mode + if (!$this->request->getAcceptsJson()) { + $this->response->format = Response::FORMAT_HTML; + } + // Passing false here for reasons. Craft::$app->getUser()->logout(false); @@ -791,6 +801,11 @@ public function actionRemovePasswordResetRequirement(): ?Response */ public function actionSetPassword(): Response { + // Set the default response format to HTML, in case it was set to JSON for headless mode + if (!$this->request->getAcceptsJson()) { + $this->response->format = Response::FORMAT_HTML; + } + // Have they just submitted a password, or are we just displaying the page? if (!$this->request->getIsPost()) { if (!is_array($info = $this->_processTokenRequest())) { @@ -886,6 +901,11 @@ public function actionSetPassword(): Response */ public function actionVerifyEmail(): Response { + // Set the default response format to HTML, in case it was set to JSON for headless mode + if (!$this->request->getAcceptsJson()) { + $this->response->format = Response::FORMAT_HTML; + } + if (!is_array($info = $this->_processTokenRequest())) { return $info; } diff --git a/src/web/Request.php b/src/web/Request.php index 3d8bd0aeec4..9ea92e6d95a 100644 --- a/src/web/Request.php +++ b/src/web/Request.php @@ -1741,10 +1741,7 @@ private function _checkIfActionRequestInternal(bool $checkSpecialPaths): bool } // Special path? - if ( - $checkSpecialPaths && - ($this->_isCpRequest || !$this->generalConfig->headlessMode) - ) { + if ($checkSpecialPaths) { $specialPaths = [ [ $this->_isCpRequest ? self::CP_PATH_LOGIN : $this->generalConfig->getLoginPath(),