From 7d6e0a260b3cd57e20497f66defbfcec8f20d22d Mon Sep 17 00:00:00 2001 From: Joel Lee Date: Mon, 26 Feb 2024 18:33:45 +0800 Subject: [PATCH 1/2] fix: improve mfa QR Code resilience --- internal/api/mfa.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/api/mfa.go b/internal/api/mfa.go index 94c422f0a..d3de72af6 100644 --- a/internal/api/mfa.go +++ b/internal/api/mfa.go @@ -124,7 +124,7 @@ func (a *API) EnrollFactor(w http.ResponseWriter, r *http.Request) error { } var buf bytes.Buffer svgData := svg.New(&buf) - qrCode, _ := qr.Encode(key.String(), qr.M, qr.Auto) + qrCode, _ := qr.Encode(key.String(), qr.Q, qr.Auto) qs := goqrsvg.NewQrSVG(qrCode, DefaultQRSize) qs.StartQrSVG(svgData) if err = qs.WriteQrSVG(svgData); err != nil { From 8a098f9d7abafeb011ec82b70406925ad1301eb4 Mon Sep 17 00:00:00 2001 From: Joel Lee Date: Mon, 26 Feb 2024 19:02:39 +0800 Subject: [PATCH 2/2] fix: upgrade error correction to H --- internal/api/mfa.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/api/mfa.go b/internal/api/mfa.go index d3de72af6..b67610d1d 100644 --- a/internal/api/mfa.go +++ b/internal/api/mfa.go @@ -124,7 +124,7 @@ func (a *API) EnrollFactor(w http.ResponseWriter, r *http.Request) error { } var buf bytes.Buffer svgData := svg.New(&buf) - qrCode, _ := qr.Encode(key.String(), qr.Q, qr.Auto) + qrCode, _ := qr.Encode(key.String(), qr.H, qr.Auto) qs := goqrsvg.NewQrSVG(qrCode, DefaultQRSize) qs.StartQrSVG(svgData) if err = qs.WriteQrSVG(svgData); err != nil {