add flag to disable microsoft login
This commit is contained in:
parent
da88d807d1
commit
841c3d5fb8
3 changed files with 18 additions and 6 deletions
|
@ -16,6 +16,8 @@ from flask_migrate import Migrate, MigrateCommand
|
||||||
from flask_script import Manager, Server
|
from flask_script import Manager, Server
|
||||||
from auth.login import init_login
|
from auth.login import init_login
|
||||||
from markupsafe import Markup
|
from markupsafe import Markup
|
||||||
|
|
||||||
|
from config import Configuration
|
||||||
from models import db
|
from models import db
|
||||||
from models.anonymous_user import AnonymouseUser
|
from models.anonymous_user import AnonymouseUser
|
||||||
from utils import euro_string, price_range_string
|
from utils import euro_string, price_range_string
|
||||||
|
@ -108,6 +110,7 @@ def add_routes(application: Flask) -> None:
|
||||||
application.register_blueprint(order_bp, url_prefix="/order")
|
application.register_blueprint(order_bp, url_prefix="/order")
|
||||||
application.register_blueprint(stats_blueprint, url_prefix="/stats")
|
application.register_blueprint(stats_blueprint, url_prefix="/stats")
|
||||||
application.register_blueprint(auth_bp, url_prefix="/")
|
application.register_blueprint(auth_bp, url_prefix="/")
|
||||||
|
if Configuration.ENABLE_MICROSOFT_AUTH:
|
||||||
application.register_blueprint(auth_microsoft_bp,
|
application.register_blueprint(auth_microsoft_bp,
|
||||||
url_prefix="/users/auth/microsoft_graph_auth") # "/auth/microsoft")
|
url_prefix="/users/auth/microsoft_graph_auth") # "/auth/microsoft")
|
||||||
application.register_blueprint(auth_zeus_bp, url_prefix="/auth/zeus")
|
application.register_blueprint(auth_zeus_bp, url_prefix="/auth/zeus")
|
||||||
|
@ -167,6 +170,10 @@ def create_app():
|
||||||
add_routes(app)
|
add_routes(app)
|
||||||
add_template_filters(app)
|
add_template_filters(app)
|
||||||
|
|
||||||
|
@app.context_processor
|
||||||
|
def inject_config():
|
||||||
|
return dict(configuration=Configuration)
|
||||||
|
|
||||||
return app_manager
|
return app_manager
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,5 +14,7 @@ class Configuration:
|
||||||
LOGFILE = "haldis.log"
|
LOGFILE = "haldis.log"
|
||||||
ZEUS_KEY = "tomtest"
|
ZEUS_KEY = "tomtest"
|
||||||
ZEUS_SECRET = "blargh"
|
ZEUS_SECRET = "blargh"
|
||||||
|
|
||||||
|
ENABLE_MICROSOFT_AUTH = False
|
||||||
MICROSOFT_AUTH_ID = ""
|
MICROSOFT_AUTH_ID = ""
|
||||||
MICROSOFT_AUTH_SECRET = ""
|
MICROSOFT_AUTH_SECRET = ""
|
||||||
|
|
|
@ -63,7 +63,8 @@
|
||||||
<nav class="navbar navbar-default navbar-fixed-top">
|
<nav class="navbar navbar-default navbar-fixed-top">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="navbar-header">
|
<div class="navbar-header">
|
||||||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
|
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
|
||||||
|
aria-expanded="false" aria-controls="navbar">
|
||||||
<span class="sr-only">Toggle navigation</span>
|
<span class="sr-only">Toggle navigation</span>
|
||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
|
@ -81,7 +82,9 @@
|
||||||
</ul>
|
</ul>
|
||||||
<ul class="nav navbar-nav navbar-right">
|
<ul class="nav navbar-nav navbar-right">
|
||||||
{% if current_user.is_anonymous() %}
|
{% if current_user.is_anonymous() %}
|
||||||
|
{% if configuration.ENABLE_MICROSOFT_AUTH %}
|
||||||
<li><a href="{{ url_for('auth_microsoft_bp.login') }}">Login with Microsoft</a></li>
|
<li><a href="{{ url_for('auth_microsoft_bp.login') }}">Login with Microsoft</a></li>
|
||||||
|
{% endif %}
|
||||||
<li><a href="{{ url_for('auth_zeus_bp.login') }}">Login with Zeus</a></li>
|
<li><a href="{{ url_for('auth_zeus_bp.login') }}">Login with Zeus</a></li>
|
||||||
{% else %}
|
{% else %}
|
||||||
<li><a href="{{ url_for('general_bp.profile') }}">{{ current_user.username }}</a></li>
|
<li><a href="{{ url_for('general_bp.profile') }}">{{ current_user.username }}</a></li>
|
||||||
|
|
Loading…
Reference in a new issue