diff --git a/dockflare/app/templates/auth/login_disabled.html b/dockflare/app/templates/auth/login_disabled.html deleted file mode 100644 index 4c5cdd4..0000000 --- a/dockflare/app/templates/auth/login_disabled.html +++ /dev/null @@ -1,18 +0,0 @@ -{% extends "base.html" %} - -{% block title %}{{ title }}{% endblock %} - -{% block content %} -
-
-
-

{{ title }}

-

Password login has been disabled by the administrator.

-

Please use an alternative login method, such as a Cloudflare Access policy.

- -
-
-
-{% endblock %} diff --git a/dockflare/app/templates/settings.html b/dockflare/app/templates/settings.html index 2e7e49b..ebddbcf 100644 --- a/dockflare/app/templates/settings.html +++ b/dockflare/app/templates/settings.html @@ -301,7 +301,7 @@
diff --git a/dockflare/app/web/auth_routes.py b/dockflare/app/web/auth_routes.py index e0b2b8b..0a3c854 100644 --- a/dockflare/app/web/auth_routes.py +++ b/dockflare/app/web/auth_routes.py @@ -18,9 +18,7 @@ class LoginForm(FlaskForm): def login(): """Handles the user login process.""" if current_app.config.get('DISABLE_PASSWORD_LOGIN'): - flash('Password login is disabled. Please use an alternative login method.', 'warning') - # Still render a basic page, but without the form. - return render_template('auth/login_disabled.html', title="Login Disabled") + return redirect(url_for('web.status_page')) if current_user.is_authenticated: return redirect(url_for('web.status_page')) diff --git a/dockflare/app/web/forms.py b/dockflare/app/web/forms.py index aa9900f..fb448e7 100644 --- a/dockflare/app/web/forms.py +++ b/dockflare/app/web/forms.py @@ -15,7 +15,7 @@ # along with this program. If not, see . # app/web/forms.py from flask_wtf import FlaskForm -from wtforms import PasswordField, SubmitField, StringField, IntegerField, BooleanField +from wtforms import BooleanField, PasswordField, SubmitField, StringField, IntegerField from wtforms.validators import DataRequired, EqualTo, Length, Optional class SettingsForm(FlaskForm): diff --git a/dockflare/app/web/routes.py b/dockflare/app/web/routes.py index 3f575ad..71818e3 100644 --- a/dockflare/app/web/routes.py +++ b/dockflare/app/web/routes.py @@ -102,6 +102,9 @@ def gating_logic(): if hasattr(current_app, 'login_manager'): + if current_app.config.get('DISABLE_PASSWORD_LOGIN'): + return + if not current_user.is_authenticated: if request.endpoint and not request.endpoint.startswith('auth.') and request.endpoint != 'static':