mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-11-08 14:40:27 +00:00
Replace PyQRCode with qrcode
qrcode is more common and better maintained Signed-off-by: Felix Kaechele <felix@kaechele.ca>
This commit is contained in:
parent
9b8c85c5c1
commit
b8e38b4d2f
@ -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',
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user