Skip to content

Commit cac0c7c

Browse files
authored
Merge pull request #68 from yuancjun/patch-1
Fix QR code alignment pattern placement for 2FA setup
2 parents 3d15c48 + 52e0ff5 commit cac0c7c

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

frontend/shared/lib/qr-code.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,11 @@ function placeTiming(matrix: QRMatrix) {
223223
function placeAlignment(matrix: QRMatrix, positions: number[]) {
224224
for (const y of positions) {
225225
for (const x of positions) {
226-
if (matrix.reserved[y]?.[x]) continue;
226+
const overlapsFinder =
227+
(x === 6 && y === 6) ||
228+
(x === 6 && y === matrix.size - 7) ||
229+
(x === matrix.size - 7 && y === 6);
230+
if (overlapsFinder) continue;
227231
for (let dy = -2; dy <= 2; dy += 1) {
228232
for (let dx = -2; dx <= 2; dx += 1) {
229233
const value = Math.max(Math.abs(dx), Math.abs(dy)) !== 1;

0 commit comments

Comments
 (0)