diff --git a/app/views.py b/app/views.py index 01fa4ec..1a37d53 100644 --- a/app/views.py +++ b/app/views.py @@ -8,7 +8,8 @@ from functools import wraps from io import BytesIO 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_login import login_user, logout_user, current_user, login_required from werkzeug import secure_filename @@ -712,9 +713,9 @@ def qrcode(): return redirect(url_for('index')) # 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() - url.svg(stream, scale=3) + img.save(stream) return stream.getvalue(), 200, { 'Content-Type': 'image/svg+xml', 'Cache-Control': 'no-cache, no-store, must-revalidate', diff --git a/requirements.txt b/requirements.txt index 3bd24b6..d24dbe8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,6 +9,6 @@ Flask-SQLAlchemy==2.1 SQLAlchemy==1.0.9 sqlalchemy-migrate==0.10.0 pyotp==2.2.1 -PyQRCode==1.2 +qrcode==5.3 Flask-OAuthlib==0.9.3 dnspython>=1.12.0