We are getting intermittent 502 on QR Code generation, and I wonder is anyone else experiencing this? Is it something to do with https://github.com/Spomky-Labs/otphp/issues/128 ?

Comments

texas-bronius created an issue. See original summary.

texas-bronius’s picture

Fyi swapping out QR Code generator for One Time Password might be:

composer require endroid/qr-code

In PasswordSetupForm.php:

...
use Endroid\QrCode\QrCode;
...

and update:

...
      $password = $user->one_time_password->getOneTimePassword();
      $form['qr_code'] = [
        '#theme' => 'image',
        '#uri' => $password->getQrCodeUri(),
      ];
... // to  look more something like:
    $uri = $user->one_time_password->getOneTimePassword()->getProvisioningUri();
    $qr_code = new QrCode($uri);
    $qr_code->setSize(200);

    $form['qr_code'] = [
      '#theme' => 'image',
      '#uri' => $qr_code->writeDataUri(),
      '#theme_wrappers' => ['container'],
    ];

I hope this helps. May be a patch one day.

sam152’s picture

This is a great idea and probably more secure too. Might be worth a quick audit of the library before integrating.

sam152’s picture

StatusFileSize
new1.33 KB

Implementing your approach, seems to work well.

sam152’s picture

Status: Active » Needs review
texas-bronius’s picture

Status: Needs review » Needs work

Sweet- thanks for validating :) We've been using in prod for just a week now, no issue.

I think module's composer needs to be told of `Endroid\QrCode` right?

sam152’s picture

The endroid/qr-code package was added, composer should know how to autoload the library from there.

sam152’s picture

Status: Needs work » Needs review
kim.pepper’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new204.28 KB

I can confirm manually testing this patch works for enabling otp from a user account.

  • Sam152 committed ef01a0d on 8.x-1.x
    Issue #3143314 by Sam152, kim.pepper, texas-bronius: One Time Password:...
sam152’s picture

Status: Reviewed & tested by the community » Fixed

Awesome, thank you all.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.