Replace PyQRCode with qrcode

qrcode is more common and better maintained

Signed-off-by: Felix Kaechele <felix@kaechele.ca>
This commit is contained in:
Felix Kaechele 2016-09-17 06:41:22 -07:00
parent 9b8c85c5c1
commit b8e38b4d2f
2 changed files with 5 additions and 4 deletions

View File

@ -8,7 +8,8 @@ from functools import wraps
from io import BytesIO from io import BytesIO
import jinja2 import jinja2
import pyqrcode import qrcode as qrc
import qrcode.image.svg as qrc_svg
from flask import g, request, make_response, jsonify, render_template, session, redirect, url_for, send_from_directory, abort from flask import g, request, make_response, jsonify, render_template, session, redirect, url_for, send_from_directory, abort
from flask_login import login_user, logout_user, current_user, login_required from flask_login import login_user, logout_user, current_user, login_required
from werkzeug import secure_filename from werkzeug import secure_filename
@ -712,9 +713,9 @@ def qrcode():
return redirect(url_for('index')) return redirect(url_for('index'))
# render qrcode for FreeTOTP # render qrcode for FreeTOTP
url = pyqrcode.create(current_user.get_totp_uri()) img = qrc.make(current_user.get_totp_uri(), image_factory=qrc_svg.SvgImage)
stream = BytesIO() stream = BytesIO()
url.svg(stream, scale=3) img.save(stream)
return stream.getvalue(), 200, { return stream.getvalue(), 200, {
'Content-Type': 'image/svg+xml', 'Content-Type': 'image/svg+xml',
'Cache-Control': 'no-cache, no-store, must-revalidate', 'Cache-Control': 'no-cache, no-store, must-revalidate',

View File

@ -9,6 +9,6 @@ Flask-SQLAlchemy==2.1
SQLAlchemy==1.0.9 SQLAlchemy==1.0.9
sqlalchemy-migrate==0.10.0 sqlalchemy-migrate==0.10.0
pyotp==2.2.1 pyotp==2.2.1
PyQRCode==1.2 qrcode==5.3
Flask-OAuthlib==0.9.3 Flask-OAuthlib==0.9.3
dnspython>=1.12.0 dnspython>=1.12.0