Replaced auth.app with current_app.
This commit is contained in:
parent
2de770aed0
commit
51e51ae4e2
@ -27,7 +27,8 @@ import typing as t
|
|||||||
from functools import wraps
|
from functools import wraps
|
||||||
from secrets import token_urlsafe, randbits
|
from secrets import token_urlsafe, randbits
|
||||||
|
|
||||||
from flask import g, request, Response, session, abort, Flask, Request
|
from flask import g, request, Response, session, abort, Flask, Request, \
|
||||||
|
current_app
|
||||||
from itsdangerous import URLSafeTimedSerializer, BadData
|
from itsdangerous import URLSafeTimedSerializer, BadData
|
||||||
from werkzeug.datastructures import Authorization
|
from werkzeug.datastructures import Authorization
|
||||||
|
|
||||||
@ -59,8 +60,6 @@ class DigestAuth:
|
|||||||
= ["auth", "auth-int"]
|
= ["auth", "auth-int"]
|
||||||
"""A list of supported quality of protection supported, either
|
"""A list of supported quality of protection supported, either
|
||||||
``qop``, ``auth-int``, both, or empty. Default is both."""
|
``qop``, ``auth-int``, both, or empty. Default is both."""
|
||||||
self.app: t.Optional[Flask] = None
|
|
||||||
"""The current Flask application."""
|
|
||||||
self.__get_password_hash: BasePasswordHashGetter \
|
self.__get_password_hash: BasePasswordHashGetter \
|
||||||
= BasePasswordHashGetter()
|
= BasePasswordHashGetter()
|
||||||
"""The callback to return the password hash."""
|
"""The callback to return the password hash."""
|
||||||
@ -343,7 +342,6 @@ class DigestAuth:
|
|||||||
:return: None.
|
:return: None.
|
||||||
"""
|
"""
|
||||||
app.digest_auth = self
|
app.digest_auth = self
|
||||||
self.app = app
|
|
||||||
|
|
||||||
if hasattr(app, "login_manager"):
|
if hasattr(app, "login_manager"):
|
||||||
from flask_login import LoginManager, login_user
|
from flask_login import LoginManager, login_user
|
||||||
@ -412,7 +410,7 @@ class DigestAuth:
|
|||||||
if "user" in session:
|
if "user" in session:
|
||||||
del session["user"]
|
del session["user"]
|
||||||
try:
|
try:
|
||||||
if hasattr(self.app, "login_manager"):
|
if hasattr(current_app, "login_manager"):
|
||||||
from flask_login import logout_user
|
from flask_login import logout_user
|
||||||
logout_user()
|
logout_user()
|
||||||
except ModuleNotFoundError:
|
except ModuleNotFoundError:
|
||||||
|
Loading…
Reference in New Issue
Block a user