forked from Github-Mirrors/canaille
refactor: use the Features class to know if a feature is available
instead of simply looking at the configuration
This commit is contained in:
parent
650391891a
commit
6d8799d052
3 changed files with 4 additions and 4 deletions
|
@ -41,7 +41,7 @@ def setup_blueprints(app):
|
|||
|
||||
app.register_blueprint(canaille.core.endpoints.bp)
|
||||
|
||||
if "CANAILLE_OIDC" in app.config:
|
||||
if app.features.has_oidc:
|
||||
import canaille.oidc.endpoints
|
||||
|
||||
app.register_blueprint(canaille.oidc.endpoints.bp)
|
||||
|
@ -113,7 +113,7 @@ def create_app(
|
|||
setup_themer(app)
|
||||
setup_flask(app)
|
||||
|
||||
if "CANAILLE_OIDC" in app.config:
|
||||
if app.features.has_oidc:
|
||||
from .oidc.oauth import setup_oauth
|
||||
|
||||
setup_oauth(app)
|
||||
|
|
|
@ -47,7 +47,7 @@ def smtp_needed():
|
|||
def wrapper(view_function):
|
||||
@wraps(view_function)
|
||||
def decorator(*args, **kwargs):
|
||||
if current_app.config["CANAILLE"].get("SMTP"):
|
||||
if current_app.features.has_smtp:
|
||||
return view_function(*args, **kwargs)
|
||||
|
||||
message = _("No SMTP server has been configured")
|
||||
|
|
|
@ -68,7 +68,7 @@ def index():
|
|||
if user.can_edit_self or user.can_manage_users:
|
||||
return redirect(url_for("core.account.profile_edition", edited_user=user))
|
||||
|
||||
if "CANAILLE_OIDC" in current_app.config and user.can_use_oidc:
|
||||
if current_app.features.has_oidc and user.can_use_oidc:
|
||||
return redirect(url_for("oidc.consents.consents"))
|
||||
|
||||
return redirect(url_for("core.account.about"))
|
||||
|
|
Loading…
Reference in a new issue