Fixed login page getting called even if authentication is disabled. #2441

pull/2444/head v1.4.3-beta.14
morpheus65535 2 months ago
parent a41dc546aa
commit 4d11b9580c

@ -4,7 +4,8 @@ import os
import requests
import mimetypes
from flask import request, abort, render_template, Response, session, send_file, stream_with_context, Blueprint
from flask import (request, abort, render_template, Response, session, send_file, stream_with_context, Blueprint,
redirect)
from functools import wraps
from urllib.parse import unquote
@ -65,6 +66,10 @@ def check_login(actual_method):
@ui_bp.route('/', defaults={'path': ''})
@ui_bp.route('/<path:path>')
def catch_all(path):
if path.startswith('login') and settings.auth.type not in ['basic', 'form']:
# login page has been accessed when no authentication is enabled
return redirect('/', code=302)
auth = True
if settings.auth.type == 'basic':
auth = request.authorization

Loading…
Cancel
Save