2023-03-03 06:22:07 +00:00
|
|
|
Index: Flask-Security-Too-5.1.1/flask_security/core.py
|
2022-02-28 06:21:54 +00:00
|
|
|
===================================================================
|
2023-03-03 06:22:07 +00:00
|
|
|
--- Flask-Security-Too-5.1.1.orig/flask_security/core.py
|
|
|
|
+++ Flask-Security-Too-5.1.1/flask_security/core.py
|
|
|
|
@@ -1579,7 +1579,7 @@ class Security:
|
2022-02-28 06:21:54 +00:00
|
|
|
and "authenticator" in cv("TWO_FACTOR_ENABLED_METHODS", app=app)
|
|
|
|
)
|
|
|
|
if need_qrcode:
|
2022-09-30 06:53:24 +00:00
|
|
|
- self._check_modules("qrcode", "TWO_FACTOR or UNIFIED_SIGNIN")
|
2022-02-28 06:21:54 +00:00
|
|
|
+ self._check_modules("pyqrcodeng", "TWO_FACTOR or UNIFIED_SIGNIN")
|
|
|
|
|
|
|
|
need_sms = (
|
|
|
|
cv("UNIFIED_SIGNIN", app=app)
|
2023-03-03 06:22:07 +00:00
|
|
|
Index: Flask-Security-Too-5.1.1/flask_security/totp.py
|
2022-02-28 06:21:54 +00:00
|
|
|
===================================================================
|
2023-03-03 06:22:07 +00:00
|
|
|
--- Flask-Security-Too-5.1.1.orig/flask_security/totp.py
|
|
|
|
+++ Flask-Security-Too-5.1.1/flask_security/totp.py
|
2022-09-30 06:53:24 +00:00
|
|
|
@@ -140,15 +140,11 @@ class Totp:
|
2022-02-28 06:21:54 +00:00
|
|
|
.. versionadded:: 4.0.0
|
|
|
|
"""
|
|
|
|
try:
|
2022-09-30 06:53:24 +00:00
|
|
|
- import qrcode
|
|
|
|
- import qrcode.image.svg
|
2022-02-28 06:21:54 +00:00
|
|
|
+ import pyqrcodeng
|
|
|
|
|
2022-09-30 06:53:24 +00:00
|
|
|
- image = qrcode.make(
|
|
|
|
- self.get_totp_uri(username, totp),
|
|
|
|
- image_factory=qrcode.image.svg.SvgImage,
|
|
|
|
- )
|
|
|
|
+ image = pyqrcodeng.create(self.get_totp_uri(username, totp))
|
2022-02-28 06:21:54 +00:00
|
|
|
with io.BytesIO() as virtual_file:
|
2022-09-30 06:53:24 +00:00
|
|
|
- image.save(virtual_file)
|
|
|
|
+ image.svg(virtual_file, scale=1)
|
2022-02-28 06:21:54 +00:00
|
|
|
image_as_str = base64.b64encode(virtual_file.getvalue()).decode("ascii")
|
2022-09-30 06:53:24 +00:00
|
|
|
|
|
|
|
return f"data:image/svg+xml;base64,{image_as_str}"
|