Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Add border padding around generated QR codes for improved scanning (#1580)

Leendert de Borst6c5fdf3470e0
diff --git a/apps/server/AliasVault.Admin/Main/Pages/Account/Manage/EnableAuthenticator.razor b/apps/server/AliasVault.Admin/Main/Pages/Account/Manage/EnableAuthenticator.razor
index f322c41c9..6a26bba75 100644
--- a/apps/server/AliasVault.Admin/Main/Pages/Account/Manage/EnableAuthenticator.razor
+++ b/apps/server/AliasVault.Admin/Main/Pages/Account/Manage/EnableAuthenticator.razor
@@ -1,4 +1,4 @@
-@page "/account/manage/enable-authenticator"
+@page "/account/manage/enable-authenticator"
@using System.ComponentModel.DataAnnotations
@using System.Globalization
@@ -32,7 +32,7 @@ else
<ol class="list-decimal space-y-4">
<li>
<p class="text-gray-700 dark:text-gray-300">
- Download a two-factor authenticator app like Microsoft Authenticator for
+ Register this 2FA code in your AliasVault account itself, or download a separate two-factor authenticator app like Microsoft Authenticator for
<a href="https://go.microsoft.com/fwlink/?Linkid=825072" class="text-blue-600 hover:underline dark:text-blue-400">Android</a> and
<a href="https://go.microsoft.com/fwlink/?Linkid=825073" class="text-blue-600 hover:underline dark:text-blue-400">iOS</a> or
Google Authenticator for
diff --git a/apps/server/AliasVault.Admin/wwwroot/js/utilities.js b/apps/server/AliasVault.Admin/wwwroot/js/utilities.js
index a87188451..65685b833 100644
--- a/apps/server/AliasVault.Admin/wwwroot/js/utilities.js
+++ b/apps/server/AliasVault.Admin/wwwroot/js/utilities.js
@@ -54,6 +54,7 @@ window.blazorNavigate = (url) => {
/**
* Generate a QR code for the given id element that has a data-url attribute.
+ * Includes proper quiet zone (white padding) for reliable scanning in dark mode.
* @param id
*/
function generateQrCode(id) {
@@ -76,10 +77,20 @@ function generateQrCode(id) {
return; // Silently fail
}
+ // Create a wrapper with white background and padding for the quiet zone.
+ // QR code best practices require at least 4 modules of quiet zone (white space)
+ // around the code for reliable scanning, especially important in dark mode.
+ const qrWrapper = document.createElement('div');
+ qrWrapper.style.display = 'inline-block';
+ qrWrapper.style.padding = '16px';
+ qrWrapper.style.backgroundColor = '#ffffff';
+ qrWrapper.style.borderRadius = '8px';
+
// Create a container for the QR code
const qrContainer = document.createElement('div');
qrContainer.id = `qrcode-${id}`;
- element.appendChild(qrContainer);
+ qrWrapper.appendChild(qrContainer);
+ element.appendChild(qrWrapper);
// Initialize QRCode object
let qrcode = new QRCode(qrContainer, {
diff --git a/apps/server/AliasVault.Client/wwwroot/js/utilities.js b/apps/server/AliasVault.Client/wwwroot/js/utilities.js
index e2d3d2905..ef13c29fa 100644
--- a/apps/server/AliasVault.Client/wwwroot/js/utilities.js
+++ b/apps/server/AliasVault.Client/wwwroot/js/utilities.js
@@ -308,6 +308,7 @@ window.initTopMenu = function() {
/**
* Generate a QR code for the given id element that has a data-url attribute.
+ * Includes proper quiet zone (white padding) for reliable scanning in dark mode.
* @param id
*/
function generateQrCode(id) {
@@ -327,10 +328,20 @@ function generateQrCode(id) {
return;
}
+ // Create a wrapper with white background and padding for the quiet zone.
+ // QR code best practices require at least 4 modules of quiet zone (white space)
+ // around the code for reliable scanning, especially important in dark mode.
+ const qrWrapper = document.createElement('div');
+ qrWrapper.style.display = 'inline-block';
+ qrWrapper.style.padding = '16px';
+ qrWrapper.style.backgroundColor = '#ffffff';
+ qrWrapper.style.borderRadius = '8px';
+
// Create a container for the QR code
const qrContainer = document.createElement('div');
qrContainer.id = `qrcode-${id}`;
- element.appendChild(qrContainer);
+ qrWrapper.appendChild(qrContainer);
+ element.appendChild(qrWrapper);
// Initialize QRCode object
let qrcode = new QRCode(qrContainer, {