Skip to content

Commit 7d05f43

Browse files
authored
Merge pull request #28 from marcogruhl/ChangeQrCodeGenerator
Change QR code generator from google to quickchart.io
2 parents 50a1fd0 + 43d1dc7 commit 7d05f43

File tree

1 file changed

+7
-7
lines changed
  • src/app/code/community/JetRails/TwoFactor/Helper

1 file changed

+7
-7
lines changed

src/app/code/community/JetRails/TwoFactor/Helper/Totp.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public function verify ( $pin ) {
148148

149149
/**
150150
* This function simply takes in information as parameters and generates a request to
151-
* Google's chart's API to generate a QR code. These QR codes are used for account setup
151+
* quickchart.io's chart's API to generate a QR code. These QR codes are used for account setup
152152
* for TOTP authentication.
153153
* @param string email The email to assign account to
154154
* @param string issuer The issuer of the account
@@ -159,12 +159,12 @@ public function verify ( $pin ) {
159159
public function QRCode ( $email, $issuer, $secret, $size = 200 ) {
160160
// Create the standard TOTP URI using the secret, issuer, and user/host
161161
$uri = "otpauth://totp/$email?secret=" . $secret . "&issuer=" . $issuer;
162-
// Create the Google QR code GET request
163-
$url = "https://chart.googleapis.com/chart";
164-
$url .= "?cht=qr";
165-
$url .= "&chs=" . $size;
166-
$url .= "&chl=" . urlencode ( $uri );
167-
$url .= "&chld=H|0";
162+
// Create the quickchart.io QR code GET request
163+
$url = "https://quickchart.io/";
164+
$url .= "qr";
165+
$url .= "?text=" . urlencode ( $uri );
166+
$url .= "&width=" . $size . "&height=" . $size;
167+
$url .= "&margin=1";
168168
// Return the URL to the QR barcode
169169
return $url;
170170
}

0 commit comments

Comments
 (0)