[IMPROVE] Lazyload qrcode lib (#15741)

pull/15732/head
Martin Schoeler 6 years ago committed by Guilherme Gazzo
parent 3c94b0bd1b
commit 5c46639fe8
  1. 8
      app/2fa/client/accountSecurity.js

@ -2,14 +2,11 @@ import { Meteor } from 'meteor/meteor';
import { ReactiveVar } from 'meteor/reactive-var';
import { Template } from 'meteor/templating';
import toastr from 'toastr';
import qrcode from 'yaqrcode';
import { modal } from '../../ui-utils';
import { settings } from '../../settings';
import { t } from '../../utils';
window.qrcode = qrcode;
Template.accountSecurity.helpers({
showImage() {
return Template.instance().showImage.get();
@ -41,9 +38,10 @@ Template.accountSecurity.events({
'click .enable-2fa'(event, instance) {
event.preventDefault();
Meteor.call('2fa:enable', (error, result) => {
Meteor.call('2fa:enable', async (error, result) => {
const qrcode = await import('yaqrcode');
instance.imageSecret.set(result.secret);
instance.imageData.set(qrcode(result.url, { size: 200 }));
instance.imageData.set(qrcode.default(result.url, { size: 200 }));
instance.state.set('registering');

Loading…
Cancel
Save