diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ddaa955fa8..80e0f1ed9fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ - Fixed a bug where field translation indicators and action menu buttons could be autofocussed when creating a new entry within a Matrix field, or opening an element editor slideout. ([#16528](https://github.com/craftcms/cms/issues/16528)) - Fixed a bug where field values copied from another site weren’t always saving. ([#16537](https://github.com/craftcms/cms/issues/16537)) - Fixed errors that could occur on Ajax requests when deleting an inline-editable Matrix block. ([#16540](https://github.com/craftcms/cms/issues/16540)) +- Fixed compatibility with the Google Authenticator app for TOTP-based authentication. ([#16466](https://github.com/craftcms/cms/issues/16466), [#16552](https://github.com/craftcms/cms/issues/16552)) ## 5.6.1 - 2025-01-22 diff --git a/src/auth/methods/TOTP.php b/src/auth/methods/TOTP.php index d5b699dfd53..8fe50a1fd84 100644 --- a/src/auth/methods/TOTP.php +++ b/src/auth/methods/TOTP.php @@ -94,7 +94,7 @@ public function getSetupHtml(string $containerId): string ]); return $view->renderTemplate('_components/auth/methods/TOTP/setup.twig', [ - 'secret' => $secret, + 'secret' => rtrim(chunk_split($secret, 4, ' ')), 'user' => $this->user, 'qrCode' => $this->generateQrCode($secret), 'totpFormId' => $totpFormId, @@ -161,8 +161,8 @@ public function remove(): void } /** - * Gets User's 2FA secret from the database - * and returns as a string formatted into a 4 character chunks. + * Returns User's 2FA secret from the database + * or generates a new one. * * @return string */ @@ -180,7 +180,7 @@ private function secret(): string } } - return rtrim(chunk_split($secret, 4, ' ')); + return $secret; } /**