Skip to content

Commit

Permalink
Merge pull request #16553 from craftcms/bugfix/16552-andoid-qr-code-s…
Browse files Browse the repository at this point in the history
…ecret-without-spaces

google auth app now needs the secret without spaces
  • Loading branch information
brandonkelly authored Jan 28, 2025
2 parents ed59376 + 5f98a10 commit f613585
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 4 additions & 4 deletions src/auth/methods/TOTP.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
*/
Expand All @@ -180,7 +180,7 @@ private function secret(): string
}
}

return rtrim(chunk_split($secret, 4, ' '));
return $secret;
}

/**
Expand Down

0 comments on commit f613585

Please sign in to comment.