def twofactor_qrcode():
"""Return a QRcode of the TOTP URI for the current user"""
user = User.query.filter_by(id=current_user.id).first_or_404()
url = pyqrcode.create(user.get_totp_uri())
stream = BytesIO()
url.svg(stream, scale=5)
return stream.getvalue(), 200, {
'Content-Type': 'image/svg+xml',
'Cache-Control': 'no-cache, no-store, must-revalidate',
'Pragma': 'no-cache',
'Expires': '0'
}
评论列表
文章目录