python-Flask-Security-Too/use-pyqrcodeng.patch
Steve Kowalik ae8071c5bc - Upate to 5.0.2:
* Role permissions backwards compatibility bug.
  * Fix Change Password regression.
  * Support for WebAuthn.
  * Support Two-factor recovery codes.
  * Provide option to prevent user enumeration (i.e. Generic Responses).
  * Support for Python 3.10.
  * Support for Flask >= 2.2.
  * Add custom HTML attributes to improve user experience.
  * Make the required zxcvbn complexity score configurable.
  * Get rid of Flask-Mail. Flask-Mailman is now the default preferred email
    package.
  * A delete option has been added to us-setup (form and view).
  * Improve username support - the LoginForm now has a separate field for
    username.
  * Fix test and other failures with newer Flask-Login/Werkzeug versions.
  * Fix test failures with newer Flask versions.
- Drop patch endswith-assert.patch:
  * Included upstream.
- Rebase patches no-mongodb.patch and use-pyqrcodeng.patch
- Update {Build,}Requires versions.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:flask/python-Flask-Security-Too?expand=0&rev=23
2022-09-30 06:53:24 +00:00

37 lines
1.5 KiB
Diff

Index: Flask-Security-Too-5.0.2/flask_security/core.py
===================================================================
--- Flask-Security-Too-5.0.2.orig/flask_security/core.py
+++ Flask-Security-Too-5.0.2/flask_security/core.py
@@ -1523,7 +1523,7 @@ class Security:
and "authenticator" in cv("TWO_FACTOR_ENABLED_METHODS", app=app)
)
if need_qrcode:
- self._check_modules("qrcode", "TWO_FACTOR or UNIFIED_SIGNIN")
+ self._check_modules("pyqrcodeng", "TWO_FACTOR or UNIFIED_SIGNIN")
need_sms = (
cv("UNIFIED_SIGNIN", app=app)
Index: Flask-Security-Too-5.0.2/flask_security/totp.py
===================================================================
--- Flask-Security-Too-5.0.2.orig/flask_security/totp.py
+++ Flask-Security-Too-5.0.2/flask_security/totp.py
@@ -140,15 +140,11 @@ class Totp:
.. versionadded:: 4.0.0
"""
try:
- import qrcode
- import qrcode.image.svg
+ import pyqrcodeng
- image = qrcode.make(
- self.get_totp_uri(username, totp),
- image_factory=qrcode.image.svg.SvgImage,
- )
+ image = pyqrcodeng.create(self.get_totp_uri(username, totp))
with io.BytesIO() as virtual_file:
- image.save(virtual_file)
+ image.svg(virtual_file, scale=1)
image_as_str = base64.b64encode(virtual_file.getvalue()).decode("ascii")
return f"data:image/svg+xml;base64,{image_as_str}"